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

rdbms - what exactly the undo information lives in oracle? -

bash - How do you programmatically add a bats test? -

clojure - 'get' replacement that throws exception on not found? -