Getting Window control of Shell for setting parent of Modal Dialog

Topics: Prism v4 - WPF 4
Oct 13, 2010 at 2:55 PM

Hi there,

I need to display a Help -> About dialog.  I have the ViewModel calling a method on a service as per the discussion in Chapter 5: MVVM Advanced Scenarios.

In order to center the dialog in the application window, I need to set the Owner property which is of type System.Windows.Control.ContentControl.

Is there are way to grab the System.Windows.Window element defined in the Shell.xaml?

    public class ChildWindowService : IChildWindowService
        public void ShowMessageBox()
            System.Windows.MessageBox.Show("This is a test.");

        public void ShowDialog()
            RadWindow radWindow = new RadWindow();
            radWindow.Width = 400;
            radWindow.Height = 300;
            //radWindow.Owner = ?  // TODO: How do I set the owner?  How do I get the Shell Window object?
            //radWindow.Content = ? // TODO: Instantiate a view into the content.
            radWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;

Oct 13, 2010 at 4:21 PM


I think that you can find interesting the following forum thread, where this topic was also treated: Setting Owner When Showing a Dialog Box

Hope this helps.

Fernando Antivero

Oct 13, 2010 at 4:58 PM

Thanks Fernando that was so easy I feel silly.  The follow up links about doing it in other windows may prove useful as well.

Oct 13, 2010 at 5:11 PM


I am glad that you found this information helpful. We are willing for helping you as much as we can. Let me know if you have any other question.

Fernando Antivero