Search code examples
silverlightsilverlight-toolkitsilverlight-5.0

Displaying a modal dialog (ChildWindow) from a user control


I have a user control that has a Grid as a main container. This control needs to display a modal dialog. However, when I show the dialog (implements ChildWindow) from the control, nothing happens, no errors and no dialog.

MyDialog dialog = new MyDialog();
dialog.Show();

If ChildWindow is something that can only be displayed from the main page and not user control, what's my alternative?


Solution

  • Solved the problem by creating a user control and putting it in the same grid location as the original control with Visibility:Collapsed. Every time I'd need a modal dialog, I'd disable the user control that is visible and set Visibility:Visible on the modal dialog user control.

    This blog post helped a great deal: Silverlight Tutorial Part 6: Using User Controls to Implement Master/Detail Scenarios