title: WPF Navigate from frame in window to Usercontrol and pass parameters to it
body: <p>I have a modern window in WPF/C# application, in which I added a modern frame:</p>
  
  <pre><code>&lt;mui:ModernWindow x:Class="MyApp.MainWindow"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mui="http://firstfloorsoftware.com/ModernUI"
      WindowStartupLocation="CenterScreen"
      Style="{StaticResource EmptyWindow}"&gt;
  
  &lt;Window.Resources&gt;
  &lt;/Window.Resources&gt;
  &lt;Grid&gt;
  &lt;Menu x:Name="menu" Height="62" VerticalAlignment="Top" &gt;
          &lt;MenuItem x:Name="miHome" Header="Home" Click="MenuItem_Home" IsChecked="True" Width="60" FontSize="14" /&gt;
          &lt;MenuItem x:Name="miClients" Header="Clients"  FontSize="14" Click="MenuItem_Clients" Width="65"/&gt;
          &lt;MenuItem x:Name="miSuppliers" Header="Suppliers" FontSize="14"  Click="MenuItem_Suppliers" Width="81"/&gt;
          &lt;MenuItem x:Name="miReports" Header="Reports" FontSize="14"  Click="MenuItem_Reporting" Width="71"/&gt;
      &lt;/Menu&gt;
      &lt;mui:ModernFrame Margin="0,75,10,10" x:Name="frame"&gt;
  
      &lt;/mui:ModernFrame&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p></p>
  
  <p>I have MenuItems in my application, when I click on Suppliers item, I fill the frame with a usercontrol, like this:</p>
  
  <pre><code>frame.Source = new Uri("/Pages/Suppliers.xaml", UriKind.Relative);
  </code></pre>
  
  <p>Where Suppliers.xaml design is:</p>
  
  <pre><code>&lt;UserControl
               x:Class="MyApp.LinksBar.Suppliers"
               xmlns:MyApp="clr-namespace:MyApp" 
               xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
               xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
               xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
               xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
               xmlns:mui="http://firstfloorsoftware.com/ModernUI"  
               mc:Ignorable="d" 
               d:DesignHeight="575" d:DesignWidth="905"&gt;
      &lt;UserControl.Resources&gt;
      &lt;/UserControl.Resources&gt;
      &lt;Grid  Name="Grid"&gt;
          &lt;mui:ModernButton x:Name="btnmakePayment" Content="Make Payment" Click="btnMakePayment_Click" Grid.Row="2" HorizontalAlignment="Right" VerticalAlignment="Top"/&gt;
      &lt;/Grid&gt;
  &lt;/UserControl&gt;
  </code></pre>
  
  <p>When I click on "Make Payment" button, I navigate to another UserControl (MakePayment.xaml):</p>
  
  <pre><code>private void btnMakePayment_Click(object sender, RoutedEventArgs e)
  {
      NavigationCommands.GoToPage.Execute(new Uri("/Actions/MakePayment.xaml", UriKind.Relative), this);
  }
  </code></pre>
  
  <p>MakePayment.xaml design is:</p>
  
  <pre><code>&lt;UserControl
               xmlns:local="clr-namespace:MyApp.Actions" x:Class="MyApp.Actions.MakePayment" 
               xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
               xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
               xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
               xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
               xmlns:mui="http://firstfloorsoftware.com/ModernUI" xmlns:System="clr-namespace:System;assembly=mscorlib" xmlns:MyApp="clr-namespace:MyApp" 
               mc:Ignorable="d"
               Loaded="MakePayment_Loaded"
               d:DesignHeight="600" d:DesignWidth="866" &gt;
      &lt;UserControl.Resources&gt;
      &lt;/UserControl.Resources&gt;
      &lt;Grid DataContext="{StaticResource makePaymentViewSource}" Name="Grid"&gt;
          &lt;Grid.RowDefinitions&gt;
          &lt;/Grid.RowDefinitions&gt;
      &lt;Label Content="Total"  VerticalContentAlignment="Center" HorizontalAlignment="Left" VerticalAlignment="Top"/&gt;
      // More design code here ...
      &lt;/Grid&gt;
  &lt;/UserControl&gt;
  </code></pre>
  
  <p><strong>Here comes my question:</strong>
  I need to <strong>pass parameters from Suppliers UserControl to MakePayment UserControl</strong>.
  How to programmatically pass the parameters in Suppliers and read them in MakePayment?</p>
  
  <p>Thank you.</p>