One of my assignments is to pass data to another page which I understand. But how do I get the data to stay when I go back to the Page? Can someone explain how this works.
public sealed partial class MainPage : Page
{
string userName;
public MainPage()
{
this.InitializeComponent();
}
private void btnPage2_Click(object sender, RoutedEventArgs e)
{
Frame.Navigate(typeof(Page2) , userName);
}
private void btnName_Click(object sender, RoutedEventArgs e)
{
userName = Convert.ToString(txtname.Text);
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…