NavigationService.GoBack() ; I set the variable in the viewmodel and then I want to return when I return. I want to use this variable, but nothing starts, I do not want to refresh this page.
Any ideas?
Here I set the variable and I want to return to my MainPage.
void item_click(object sender, RoutedEventArgs e) { Button b = e.OriginalSource as Button; App.ViewModel.bName = b.Content.ToString(); App.ViewModel.bID = b.Name; this.NavigationService.GoBack(); }
Here, in my MainPage, I want to run a check if the variables have changed.
public MainPage() { if (App.ViewModel.bName != null) { myButton.Content = App.ViewModel.bName; myButton.Name = App.ViewModel.bID; } }
user1845258
source share