How to Open modal window/dialog in XBAP Application?

2.5k views Asked by At

In WPF, if i want to open a modal/response window then i write code like

Window1 _windowObj1 = new Window1(); _windowObj1.Owner = mainWindowObject; _window1Obj.ShowDialog();

How to do the same in XBAP. I tried it, but the window is opened independently from the parent page as i cant assign it as a Owner of modal window.

How to Open modal window/dialog in XBAP Application?

2

There are 2 answers

2
Andre Luus On

I'm not really experienced with XBAP apps, but I believe you should try displaying "popups" in an adorner layer. This has the same effect (you can't access the rest of the application), but doesn't actually open another window according to windows. Google for "wpf adorner dialog" and you should get some results.

Here are some links:

How do I make modal dialog for a Page in my WPF-application?

http://www.codeproject.com/KB/silverlight/slmodal.aspx

http://www.codeproject.com/KB/WPF/wpfmodaldialog.aspx

0
Cuong Bui On

You did implement Window of WPF? If so, it will not work in XBAP. Please host your UserControl to Windows.Form, then you can open modal window/dialog in XBAP Application