Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>For a navigable application, you'll want your start up view to be a <code>NavigationWindow</code> instead of a <code>Window</code></p> <pre><code>&lt;NavigationWindow xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="MainWindow" Title="My Application Title" Height="300" Width="400" /&gt; </code></pre> <p>Code behind:</p> <pre><code>using System.Windows.Navigation; public partial class MainWindow : NavigationWindow { public MainWindow() { InitializeComponent(); } } </code></pre> <p>The MVVM Light view templates use <code>Window</code>, but as you have guessed, you can just change it. If you want to be able to navigate to and from this view, make it a <code>Page</code>. This is how you navigate:</p> <pre><code>&lt;Page x:Class="Page1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Page1"&gt; &lt;Grid&gt; &lt;!-- this button will navigate to another page --&gt; &lt;Button Content="Go to Page 2" Click="Button_Click" /&gt; &lt;/Grid&gt; &lt;/Page&gt; </code></pre> <p>Code Behind:</p> <pre><code>using System.Windows; using System.Windows.Controls; public partial class Page1 : Page { public Page1() { InitializeComponent(); } private void Button_Click(object sender, RoutedEventArgs e) { // the Page class has a property "NavigationService" which allows you to navigate. // you can supply the "Navigate" method with a Uri or an object instance of the page base.NavigationService.Navigate(new Page2()); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload