Setting Owner When Showing a Dialog Box

Dec 16, 2008 at 5:36 AM
I would like to have a dialog box displayed when a command is executed, and have the dialog box centered in the main window of the application.
The execute command is defined in a module, so I'm unsure how to set the owner property of the dialog box.

Any ideas?
Dec 16, 2008 at 3:00 PM

Hi,

Perhaps, you may find useful the Application.Current.MainWindow property to get the main window’s instance, also you can use it in your modules without problems.

 

Please, let me know if this helps.

 

Ezequiel Sculli

http://blogs.southworks.net/esculli/

Dec 16, 2008 at 3:32 PM
Brilliant!  Thank you.
Dec 16, 2008 at 5:11 PM
Edited Dec 16, 2008 at 5:14 PM

Hi,

You may also find useful the following posts about the WindowRegionAdapter, a custom region adapter that you can use to show views (like a dialog box) in different windows, so your business logic is still decoupled from the specific UI where you want to show the view with:

·         WindowRegionAdapter for CompositeWPF (Prism)

·         WindowRegionAdapter at CompositeWPF (Prism) Contrib

 

Please, let me know if this helps.

 

Ezequiel Sculli

http://blogs.southworks.net/esculli/