c# - Set parent to wpf window -


earlier have used usercontrols show modal dialogs. decided implement wpf window. , have 1 problem. want set parent of window constructor of modaldialogwindow. know hwnd of parent window(can process name) , don't know how hwnd of child window(my modal dialog) const of it.

or need setparent window this

    var window = new modaldialogwindow(properties.resources.changelabelpartdialogtitle, changelabelpartdialog); setparent(childhwnd,parenthwnd);            window.showdialog(); 

but dont know how hwnd of window before showdialog() method

handle of parent window need. set parent dialog window can use system.windows.interop.windowinterophelper class shown in code below:

public partial class modaldialogwindow : window {     public modaldialogwindow(intptr parentwindowhandle)     {         initializecomponent();          var interop = new windowinterophelper(this);         interop.ensurehandle();         //         interop.owner = parentwindowhandle;     } } 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

c# - How do I get the Nth largest element from a list with duplicates, using LINQ? -

jsp - "Sending a redirect is forbidden after the response has been committed" in sendRedirect -