I have a test WPF application that has two windows (I'm also using MVC and not MVVM). Both which have one button that should direct the user to the other window.
Initially, I tried this code (I'm only showing the event handlers):
MainWindow.xaml.cs
private static void Button_Click(object sender, RoutedEventArgs e)
{
OtherWindow k = new OtherWindow();
k.Show();
this.Close();
}
OtherWindow.xaml.cs
private static void Button_Click(object sender, RoutedEventArgs e)
{
MainWindow k = new MainWindow();
k.Show();
this.Close();
}
The code works, but I take a look at the memory usage and it increases every time I switch window. Is this normal or is there a way to avoid this and keep the simplicity?