2

I have a main window in Which I have a button. When i click that button i want to show a dialog box which i have made using a page. I am using

Page1 P = new Page();     //Page which i want to show over my main window 

 this.P.Visibility = Visibility.Visible;

when i used Window to make dialog box it is working fine but with pages there is no Show property associated. Does anyone know Of any method to display page over Mainwindow.

murmansk
  • 845
  • 2
  • 11
  • 28

1 Answers1

1

A Page cannot be shown as a window. For this you need to use Window, both can host the same XAML content, you just need to use the right container!

See this question:

Page vs Window in WPF?

Community
  • 1
  • 1
ColinE
  • 68,894
  • 15
  • 164
  • 232
  • I am bit confused,but do you mean there is no way to show a page over a Window. – murmansk Jan 17 '12 at 06:28
  • 1
    correct - see the referenced question, pages need to be hosted in a Frame or NavigationWindow. They are not designed for this purpose. Why not just cut and paste your XAML into a Window? Or use a UserControl? – ColinE Jan 17 '12 at 06:29