c# - HwndSource win32 integration with Ribbons and KeyTips -


my situation rather complex, i've seen other people this. unfortunately, there no mention of specific problem. in process of trying integrate wpf usercontrol including ribbon win32 host application. far, has been working pretty neat (to surprise, even). using hwndsource create raw win32 child-window , embed win32 host top-level window. have tried tabcontrols, buttons, radiobuttons, webbrowsers , inside usercontrol , usable within win32 host application. and, of course, there ribbon control @ top row of usercontrol's grid.

here's doing:

mhwnd = new hwndsource (     0, 0x40000000 | 0x10000000,      0,      left,      top,      width,      height,      "cintegrationtest",      parenthandle); muserctrl = new usercontrol1 (); mhwnd.rootvisual = muserctrl; 

this works rather good. have other controls (like edit , few buttons) in usercontrol1 below ribbon. when keyboard focus inside 1 of these controls, can use alt+ access keytips of ribbontabs , it's elements. when focus not inside of wpf usercontrol, control win32 host, hotkeys not work.

i had @ implementation of hotkeys , found out class called keytipservice (found in ribboncontrolslibrary\microsoft\windows\controls\keytipservice.cs) uses inputmanager.current.postprocessinput , inputmanager.current.preprocessinput handle keytip hotkeys.

unfortunately, i'm totally out of ideas how forward necessary key events win32 application ribbon. don't know how identify messages need forwarded.

maybe here ran similar problem or has more clue wpf message processing , can me or give hints.

p.s.: i'm running visual studio 2010 premium on windows xp sp3 here , using microsoft ribbons wpf october 2010.

you should able pass unhandled key events windows form wpf layer. override onkeydown, onkeyup, , other might need. if not of form1 controls handle event, handled property of keyeventargs false.

you can convert forms.keyeventargs controls.keyeventargs , pass wpf layer. make sure not copy handled boolean, or else wpf part not handle @ all. :)

i have attached sample code illustrates idea.

public partial class form1 : system.windows.forms.form {     public form1()     {         initializecomponent();     }      protected override void onkeydown(system.windows.forms.keyeventargs e)     {         base.onkeydown(e);         if (!e.handled)         {             muserctrl.onkeydown(/* convert e controls.keyeventargs , pass */);         }     } } 

Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -