PageRenderTime 11ms CodeModel.GetById 1ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/Visual Studio 2008/CSWPFNavigationUsage/Page1.xaml.cs

#
C# | 38 lines | 29 code | 1 blank | 8 comment | 0 complexity | c7cbcdc68bfc2d1f7c0dc931a620cdc2 MD5 | raw file
 1using System;
 2using System.Collections.Generic;
 3using System.Linq;
 4using System.Text;
 5using System.Windows;
 6using System.Windows.Controls;
 7using System.Windows.Data;
 8using System.Windows.Documents;
 9using System.Windows.Input;
10using System.Windows.Media;
11using System.Windows.Media.Imaging;
12using System.Windows.Navigation;
13using System.Windows.Shapes;
14
15namespace CSWPFNavigationUsage
16{
17    /// <summary>
18    /// Interaction logic for Page1.xaml
19    /// </summary>
20    public partial class Page1 : Page
21    {
22        public Page1()
23        {
24            InitializeComponent();
25            // Get a reference to the NavigationService that navigated to this Page
26            NavigationService ns = NavigationService.GetNavigationService(this);
27        }
28        void hyperlink_Click(object sender, RoutedEventArgs e)
29        {
30            // Create a pack URI
31            Uri uri = new Uri("AnotherPage.xaml", UriKind.Relative);
32            // Get the navigation service that was used to 
33            // navigate to this page, and navigate to 
34            // AnotherPage.xaml
35            this.NavigationService.Navigate(uri);
36        }
37    }
38}