Suppose i have two different windows in WPF application Window1 and Window2.
Based on some actions from Window1, Window2 pop up for a while, and also based on some actions in Window1, Window2 should close and view returns to Window1 with it's state before Window2 appears.
With it's state i mean with all the content in all the controls that exists in Window1.
To achieve the switching i used
ShowDialog();
which i was looking exactly because i need Window1 to freeze while Window2 is on.
Right now my problem i can't return to Window1 with it's content.
MainWindow (Window1).xaml
<Window x:Class="Test.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Button Content="Button" HorizontalAlignment="Left" VerticalAlignment="Top" Width="75" Margin="193,130,0,0" Click="Button_Click"/>
</Grid></Window>
Button_Click
private void Button_Click(object sender, RoutedEventArgs e)
{
Window1 window1 = new Window1();
window1.ShowDialog();
//Actions
window1.Close();
}
and the Window1 xaml is a normal one i didn't change anything except that i made the
WindowStyle=None
so i can't exit it with the right top exit button