WPF Debugger
Hans Karlsen (talk | contribs) (Created page with "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...") |
Hans Karlsen (talk | contribs) No edit summary |
||
Line 3: | Line 3: | ||
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: | 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: | ||
var wpfdebugger = new MDriven.WPF.Debugger.OCLRuntimeDebuggerWPF(GA.Singleton.GetCurrentEcoSpace()); | var wpfdebugger = new MDriven.WPF.Debugger.OCLRuntimeDebuggerWPF(GA.Singleton.GetCurrentEcoSpace()); | ||
AutoFormWPF.OnNewAutoFormWPFCreated += (s, e) => { System.Windows.Forms.Integration.ElementHost.EnableModelessKeyboardInterop(e.AutoFormWPF); }; | |||
System.Windows.Forms.Integration.ElementHost.EnableModelessKeyboardInterop(wpfdebugger); | System.Windows.Forms.Integration.ElementHost.EnableModelessKeyboardInterop(wpfdebugger); | ||
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. |
Revision as of 11:31, 2 May 2019
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:
var wpfdebugger = new MDriven.WPF.Debugger.OCLRuntimeDebuggerWPF(GA.Singleton.GetCurrentEcoSpace()); 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.
This page was edited more than 11 months ago on 02/10/2024. What links here