Windows : MainWindow ,Window1 ,Window2,Window3,Window4;
Structure: MainWindow -->{Window1 or Window2 or Window3}(One window only)-->Window 4.
I can move from Main Window to Window1 ,Window2 ,Window3 based on user selection on radioButton in MainWindow and finally to Window 4 from any three Windows.
How can I code for my Back button in Window4 such that I backtrack to window which was shown earlier (based on user choice).
How I did it
private void Button_Click_1(object sender, RoutedEventArgs e)
int counter = 0;
if ((bool)cone.IsChecked)
{
Window1 coneMenu = new Window1();
this.Close();
coneMenu.Show();
counter = 1;
}
else if ((bool)scoop.IsChecked)
{
Window2 scoopMenu = new Window2();
this.Close();
scoopMenu.Show();
counter = 2;
}
else if ((bool)sundae.IsChecked)
{
Window3 sundaeMenu = new Window3();
this.Close();
sundaeMenu.Show();
counter = 3;
}
MessageBox.Show("" + counter.ToString());
}
Problem:
But how do I use value of this counter in Window4 back Button.