WPF Debugger
No edit summary
(Updated Edited template to July 12, 2025.)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<message>Write the content here to display this box</message>
We added a new WPF debugger to MDriven Designer some time ago. Now, it is also available in runtime for you to include in your WPF applications.
We added a new WPF debugger to MDriven Designer some time ago. Now, it is also available in runtime for you to include in your WPF applications.


If you have a WPF application that makes use of some windows forms - and your "Application" object is of winform kind - then you need to instruct WPF that this is the case on a window-by-window basis:
If you have a WPF application that makes use of some Windows forms - and your "Application" object is of winform kind - then you need to instruct WPF that this is the case on a window-by-window basis:
  Eco.WPF.WPFDequeuer.Active = true;  // The debugger (and all MDriven WPF UI needs the WPFDequeuer active to make derivations on screen evaluate)
  Eco.WPF.WPFDequeuer.Active = true;  // The debugger (and all MDriven WPF UI needs the WPFDequeuer active to make derivations on screen evaluate)
   
   
Line 11: Line 12:
   
   
  wpfdebugger.Show();
  wpfdebugger.Show();
In the code above, notice the System.Windows.Forms.Integration.ElementHost.EnableModelessKeyboardInterop call on the WPF form. This ensures that keys and events work for true WPF forms in a Windows forms environment.
In the code above, notice the ''System.Windows.Forms.Integration.ElementHost.EnableModelessKeyboardInterop'' call on the WPF form. This ensures that keys and events work for true WPF forms in a Windows forms environment.
[[Category:MDriven Designer]]
[[Category:MDriven Designer]]
[[Category:Debugging]]
[[Category:Debugging]]
{{Edited|July|12|2025}}

Latest revision as of 06:25, 20 January 2025

This page was created by Hans.karlsen@mdriven.net on 2019-04-29. Last edited by Edgar on 2025-01-20.

We added a new WPF debugger to MDriven Designer some time ago. Now, it is also available in runtime for you to include in your WPF applications.

If you have a WPF application that makes use of some Windows forms - and your "Application" object is of winform kind - then you need to instruct WPF that this is the case on a window-by-window basis:

Eco.WPF.WPFDequeuer.Active = true;  // The debugger (and all MDriven WPF UI needs the WPFDequeuer active to make derivations on screen evaluate)

var wpfdebugger = new MDriven.WPF.Debugger.OCLRuntimeDebuggerWPF(GA.Singleton.GetCurrentEcoSpace());

// Next 2 rows are optional - needed when mixing WinForms and WPF to make keyboard work
AutoFormWPF.OnNewAutoFormWPFCreated += (s, e) => { System.Windows.Forms.Integration.ElementHost.EnableModelessKeyboardInterop(e.AutoFormWPF); };
System.Windows.Forms.Integration.ElementHost.EnableModelessKeyboardInterop(wpfdebugger);

wpfdebugger.Show();

In the code above, notice the System.Windows.Forms.Integration.ElementHost.EnableModelessKeyboardInterop call on the WPF form. This ensures that keys and events work for true WPF forms in a Windows forms environment.