I want to open window2.xaml from the window1.xaml window as an emergent (floating) window. In winforms that was form2.show() , how do I do it in WPF for both WPF application and WPFbrowser application? (I assume it's different for WPF application and WPFbrowser application)
+2
A:
It is not much different in WPF than winforms. The method itself is still Show() for a WPF window.
Button btnClick = new Button();
btnClick.Click += btnClick_Click;
void btnClick_Click(object sender, RoutedEventArgs e)
{
window2 exampleWindow = new window2();
exampleWindow.Show();
}
You pick where you want to instantiate and show the window depending on how you want your program to operate.
Update:
In a WPF web app you have ChildWindows. If you create your own custom window which inherits ChildWindow it will call just like any other window in a WPF app. The method is once again.
exampleChildWindow.Show();
jsmith
2010-06-05 15:11:37
thanks, I also would like to do the same for a WPF application, but it's different for that type of application, right? how do I do it in a WPF application? (web)
Meli
2010-06-05 15:23:23