Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
4970
How to open DialogWindow?
posted

Just look at sample for dialogwindow. The code like:

XamDialogWindow win = CreateDialogWindow();
win.ModalBackgroundEffect = null;
win.IsModal = true;
win.Content = new MyUsercontrol();
this.LayoutRoot.Children.Add(win);

So it means when open a dialog, you must find out a parent container for it. My situation is:

I have a toolbar user control with height like height = 25. Then there is a button to open a dialogwindow.

Then I use this toolbar control in any other user control, when open dialogwindow with above kind of code, it will expand toolbar height because it is inside the tool bar and messed up the UI layout.

But what I want it the dialogwindow can be opened based on brower window, not the control.

How to reslove this problem it?

 

  • 5170
    Offline posted

    This has nothing to do with limitations of Silverlight, but rather the desing of the XamDialogWindow control.  I just blogged about how to show the XamDialogWindow in a ViewModel without it being part of the visual tree.  Of course, as the post says, I would still use a Dialog Service to show the dialog as your VM should be ignorant to Views. 

    http://brianlagunas.com/2013/05/18/showing-the-xamdialogwindow-from-a-viewmodel-in-silverlight-and-wpf/

  • 40030
    Verified Answer
    Offline posted

    Hi, 

    The XDW has to be part of the VisualTree for various limitations of what can be done in SL.

    What you could do is create a custom Panel, that doesn't position or size to it's children and place that in your toolbar and place the xdw in that panel. 

    Then you're toolbar won't resize. 

    Note: then the RestirctInContainer property must be set to false (which i believe is the default)

    -SteveZ