PageRenderTime 13ms CodeModel.GetById 9ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/Visual Studio 2008/CSWPFNavigationUsage/MainPage.xaml

#
XAML | 77 lines | 62 code | 8 blank | 7 comment | 0 complexity | 84fc5ac0f1fbe07077322f164f101288 MD5 | raw file
 1<Page x:Class="CSWPFNavigationUsage.MainPage"
 2    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 3    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 4    Title="Main Page">
 5    <!--When a Hyperlink is clicked, WPF calls NavigationService.
 6     Navigate to locate and download the Page at the specified path-->
 7   
 8    <StackPanel>
 9        <!--use Hyperlink.NavigateUri property to navigate-->
10        <Border CornerRadius="10" Background="Orange" BorderThickness="2" Padding="5" Margin="5">
11            <WrapPanel>
12                <TextBlock Text ="Navigate to" VerticalAlignment ="Center"/>
13                <Label>
14                    <Hyperlink  NavigateUri="Page1.xaml">
15                        page1
16                    </Hyperlink>
17                </Label>
18                <TextBlock Text="using Hyperlink.NavigateUri property" VerticalAlignment="Center"/>
19            </WrapPanel>
20        </Border>
21
22        <!--use Hyperlink.NavigateUri property to navigate-->
23        <Border CornerRadius="10" Background="Orange" BorderThickness="2" Padding="5" Margin="5">
24            <WrapPanel>
25                <TextBlock Text="Navigate to Page1 using Hyperlink.NavigateUri property. Click the image to navigate to Page1:" TextWrapping="Wrap"/>
26                <Label>
27                    <Hyperlink  NavigateUri="Page1.xaml">
28                        <Image Source="image.jpg" Stretch="Uniform" Height="100" />
29                    </Hyperlink>
30                </Label>
31            </WrapPanel>
32        </Border>
33
34        <!--handle Hyperlink.Click event and call NavigationService.Navigate method-->
35        <Border CornerRadius="10" Background="Orange" BorderThickness="2" Padding="5" Margin="5">
36            <WrapPanel>
37                <TextBlock Text="Navigate to" VerticalAlignment="Center"/>
38                <Label>
39                    <Hyperlink Click="OnHyperlink">
40                        Page1
41                    </Hyperlink>
42                </Label>
43                <TextBlock Text="by handling the Hyperlink.Click event and calling the NavigationService.Navigate method." 
44                       VerticalAlignment="Center" TextWrapping="Wrap"/>
45            </WrapPanel>
46        </Border>
47
48       
49        
50        <!--navigate to object by calling NavigationService.Navigate method-->
51        <Border CornerRadius="10" Background="Orange" BorderThickness="2" Padding="5" Margin="5">
52            <WrapPanel>
53                <TextBlock Text="Navigate to" VerticalAlignment="Center"/>
54                <Label>
55                    <Hyperlink Click="OnNavagateToObject">
56                        MyDummy object
57                    </Hyperlink>
58                </Label>
59                <TextBlock Text="by calling the NavigationService.Navigate method" VerticalAlignment="Center"/>
60            </WrapPanel>
61        </Border>
62        
63        <!--navigate to a Page with a Frame control in it by calling NavigationService.Navigate method-->
64        <Border CornerRadius="10" Background="Orange" BorderThickness="2" Padding="5" Margin="5">
65            <WrapPanel>
66                <TextBlock Text="Navigate to" VerticalAlignment="Center"/>
67                <Label>
68                    <Hyperlink Click="OnNavagateToPage">
69                        Page with Frame
70                    </Hyperlink>
71                </Label>
72                <TextBlock Text="by calling the NavigationService.Navigate method" VerticalAlignment="Center"/>
73            </WrapPanel>
74        </Border>
75        
76    </StackPanel>
77</Page>