0

I am developing WPF MUI application.I navigate to another page using button onclick and print some text on page1.xaml . after i navigate using another button to print another text on page1.xaml .but i could not do that.my out put was not new text.it is early details only.can't reload page1.xaml .when navigating I pass the parameter and according to parameter print deference text on same page.can anyone help me?

this is my navigation code

var frame = NavigationHelper.FindFrame(null, this);
frame.Source = new Uri("../Content/Sale/SaleInvoice/Nested/saleNested.xaml", UriKind.Relative);
har07
  • 88,338
  • 12
  • 84
  • 137
Sandun Harshana
  • 721
  • 1
  • 13
  • 28

3 Answers3

0

Have the page databound to a ViewModel. Once you want to refresh just create a new Viewmodel. It would make sense to have the execution of the reloading being done in a backgroudworker so your UI stays responsive. This is esspecially usefull if you are refreshing some resource from a webService or some other online source.

user853710
  • 1,715
  • 1
  • 13
  • 27
0

The Data bind to the page at the initial time to reload the page I'm using this method
On xaml page just add Loaded Property:

<UserControl x:Class="ModernUINavigationApp1.Pages.Page"
         ...
         Loaded="OnLoad" >

Then Add event handler in code behind to make the page do whatever you want when it's loaded

private void OnLoad(object sender, RoutedEventArgs e)
    {

    }

Hope this help :D

pavasornN
  • 13
  • 3
0

Make sure your ViewModel implements INotifyPropertyChanged. If your Page1.xaml's DataContext is set to the ViewModel, and your XAML uses bindings properly, any change to the ViewModel will be reflected in the UI. You won't need to refresh anything. Just update the property in the ViewModel object.

If you update your question with example XAML and C#, I can be of more help.

Mark Richman
  • 28,948
  • 25
  • 99
  • 159