MVVM

Page2

  1. Create New Page in Views Folder
  2. Add Namespace
    xmlns:vm="using:Blank1.ViewModels"
  3. Add DataContext
    <Page.DataContext>
     <vm:Page2ViewModel/>
    </Page.DataContext>
  4. Add Binding
    <Hub Header="{Binding MyParameter}" 
    ...

Model

  1. Create a New Class „Page2ViewModel.cs“ in ViewModels Folder
  2. Inherit from „ViewModelBase“
class Page2ViewModel : ViewModelBase
{
  public Page2ViewModel()
  {
    this.MYParameter = "Set from the constructor";
  }
  
  public override void OnNavigatedTo(string Parameter, NavigationMode mode, IDictionary<string, object> state)
  {
    this.MyParameter = Parameter?.ToString() ?? "Empty";
  }

  private string _MyParameter = defualt(string);
  public string MyParameter {get { return _MyParameter; } set { Set(ref _MyParameter, Value); } }
}

MainPage

 XAML

<Button Content="Goto Page2" Click="Goto2"/>

C#

public ViewModels.MainPageViewModel ViewModel {get; set;}

private void Goto2(object sender, Windows.UI.Xaml.RoutedEventArgs e)
{
  var app = App.Current as Common.BootStrapper;
  app.NavigationService.Navigate(typeof(Views.Page2), this.ViewModel.Value);
}