PageRenderTime 12ms CodeModel.GetById 2ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

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

#
C# | 46 lines | 41 code | 5 blank | 0 comment | 0 complexity | 444a9686ea81e3a24a98700249e9718a 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.Shapes;
13using System.Windows.Navigation;
14
15namespace CSWPFNavigationUsage
16{
17    public partial class MainPage : Page
18    {
19        public MainPage()
20        {
21            InitializeComponent();           
22        }
23
24        private void OnHyperlink(object sender, RoutedEventArgs e)
25        {
26            this.NavigationService.Navigate(new Uri("Page1.xaml", UriKind.Relative));
27        }
28      
29        private void OnNavagateToObject(object sender, RoutedEventArgs e)
30        {
31            MyDummy obj = new MyDummy() { Property1 = "Hello", Property2 = "everyone" };
32            this.NavigationService.Navigate(obj);
33        }
34       
35        private void OnNavagateToPage(object sender, RoutedEventArgs e)
36        {
37            this.NavigationService.Navigate(new Uri("FramePage.xaml", UriKind.Relative));
38        }
39    }
40
41    public class MyDummy
42    {
43        public string Property1 { get; set; }
44        public string Property2 { get; set; }
45    }
46}