Log in

WPF Debugger

From MDrivenWiki

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

If you have a WPF application that make use of some windows forms - and that you "Application" object is really 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); };


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.