PageRenderTime 40ms CodeModel.GetById 16ms 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. <StackPanel>
  8. <!--use Hyperlink.NavigateUri property to navigate-->
  9. <Border CornerRadius="10" Background="Orange" BorderThickness="2" Padding="5" Margin="5">
  10. <WrapPanel>
  11. <TextBlock Text ="Navigate to" VerticalAlignment ="Center"/>
  12. <Label>
  13. <Hyperlink NavigateUri="Page1.xaml">
  14. page1
  15. </Hyperlink>
  16. </Label>
  17. <TextBlock Text="using Hyperlink.NavigateUri property" VerticalAlignment="Center"/>
  18. </WrapPanel>
  19. </Border>
  20. <!--use Hyperlink.NavigateUri property to navigate-->
  21. <Border CornerRadius="10" Background="Orange" BorderThickness="2" Padding="5" Margin="5">
  22. <WrapPanel>
  23. <TextBlock Text="Navigate to Page1 using Hyperlink.NavigateUri property. Click the image to navigate to Page1:" TextWrapping="Wrap"/>
  24. <Label>
  25. <Hyperlink NavigateUri="Page1.xaml">
  26. <Image Source="image.jpg" Stretch="Uniform" Height="100" />
  27. </Hyperlink>
  28. </Label>
  29. </WrapPanel>
  30. </Border>
  31. <!--handle Hyperlink.Click event and call NavigationService.Navigate method-->
  32. <Border CornerRadius="10" Background="Orange" BorderThickness="2" Padding="5" Margin="5">
  33. <WrapPanel>
  34. <TextBlock Text="Navigate to" VerticalAlignment="Center"/>
  35. <Label>
  36. <Hyperlink Click="OnHyperlink">
  37. Page1
  38. </Hyperlink>
  39. </Label>
  40. <TextBlock Text="by handling the Hyperlink.Click event and calling the NavigationService.Navigate method."
  41. VerticalAlignment="Center" TextWrapping="Wrap"/>
  42. </WrapPanel>
  43. </Border>
  44. <!--navigate to object by calling NavigationService.Navigate method-->
  45. <Border CornerRadius="10" Background="Orange" BorderThickness="2" Padding="5" Margin="5">
  46. <WrapPanel>
  47. <TextBlock Text="Navigate to" VerticalAlignment="Center"/>
  48. <Label>
  49. <Hyperlink Click="OnNavagateToObject">
  50. MyDummy object
  51. </Hyperlink>
  52. </Label>
  53. <TextBlock Text="by calling the NavigationService.Navigate method" VerticalAlignment="Center"/>
  54. </WrapPanel>
  55. </Border>
  56. <!--navigate to a Page with a Frame control in it by calling NavigationService.Navigate method-->
  57. <Border CornerRadius="10" Background="Orange" BorderThickness="2" Padding="5" Margin="5">
  58. <WrapPanel>
  59. <TextBlock Text="Navigate to" VerticalAlignment="Center"/>
  60. <Label>
  61. <Hyperlink Click="OnNavagateToPage">
  62. Page with Frame
  63. </Hyperlink>
  64. </Label>
  65. <TextBlock Text="by calling the NavigationService.Navigate method" VerticalAlignment="Center"/>
  66. </WrapPanel>
  67. </Border>
  68. </StackPanel>
  69. </Page>