NavigationPageBackButtonPage.xaml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <UserControl xmlns="https://github.com/avaloniaui"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. x:Class="ControlCatalog.Pages.NavigationPageBackButtonPage">
  4. <DockPanel>
  5. <ScrollViewer DockPanel.Dock="Right" Width="280">
  6. <StackPanel Margin="12" Spacing="14">
  7. <TextBlock Text="Configuration" FontSize="16" FontWeight="SemiBold"
  8. Foreground="{DynamicResource SystemControlHighlightAccentBrush}" />
  9. <!-- Global override -->
  10. <TextBlock Text="Global Override" FontSize="13" FontWeight="SemiBold" />
  11. <TextBlock Text="IsBackButtonVisible=false hides the back button for every page in this NavigationPage."
  12. TextWrapping="Wrap" FontSize="11" Opacity="0.6" />
  13. <CheckBox x:Name="IsBackButtonVisibleCheck" Content="IsBackButtonVisible"
  14. IsChecked="True" IsCheckedChanged="OnGlobalBackButtonChanged" />
  15. <Separator />
  16. <!-- Per-page visibility -->
  17. <TextBlock Text="Per-Page Visibility" FontSize="13" FontWeight="SemiBold" />
  18. <StackPanel Spacing="6">
  19. <Button Content="Standard Page" Click="OnPushStandard"
  20. HorizontalAlignment="Stretch" />
  21. <Button Content="Hidden Back Button" Click="OnPushNoBack"
  22. HorizontalAlignment="Stretch" />
  23. </StackPanel>
  24. <Separator />
  25. <!-- Per-page enabled/disabled -->
  26. <TextBlock Text="Per-Page Enabled" FontSize="13" FontWeight="SemiBold" />
  27. <TextBlock Text="IsBackButtonEnabled=false shows the back button grayed out and non-interactive."
  28. TextWrapping="Wrap" FontSize="11" Opacity="0.6" />
  29. <Button Content="Disabled Back Button" Click="OnPushDisabledBack"
  30. HorizontalAlignment="Stretch" />
  31. <Separator />
  32. <!-- Custom BackButtonContent -->
  33. <TextBlock Text="Custom Back Content" FontSize="13" FontWeight="SemiBold" />
  34. <TextBlock Text="Any string, icon or control can be the back button content."
  35. TextWrapping="Wrap" FontSize="11" Opacity="0.6" />
  36. <TextBox x:Name="BackContentInput" PlaceholderText="Text content (default: Cancel)..." />
  37. <StackPanel Spacing="6">
  38. <Button Content="Push with Text Content" Click="OnPushCustomText"
  39. HorizontalAlignment="Stretch" />
  40. <Button Content="Push with Icon (×)" Click="OnPushCustomIcon"
  41. HorizontalAlignment="Stretch" />
  42. <Button Content="Push with Icon + Text" Click="OnPushIconTextBack"
  43. HorizontalAlignment="Stretch" />
  44. </StackPanel>
  45. <Separator />
  46. <!-- Navigation Guard -->
  47. <TextBlock Text="Navigation Guard" FontSize="13" FontWeight="SemiBold" />
  48. <TextBlock Text="Push a page that intercepts back navigation."
  49. TextWrapping="Wrap" FontSize="11" Opacity="0.6" />
  50. <StackPanel Spacing="6">
  51. <RadioButton x:Name="CancelRadio" GroupName="GuardMode"
  52. Content="Cancel navigation" IsChecked="True" />
  53. <RadioButton x:Name="DeferRadio" GroupName="GuardMode"
  54. Content="Async save (1.5s)" />
  55. </StackPanel>
  56. <Button Content="Push Guarded Page" Click="OnPushGuarded"
  57. HorizontalAlignment="Stretch" />
  58. <Separator />
  59. <TextBlock Text="Navigation" FontSize="13" FontWeight="SemiBold" />
  60. <StackPanel Spacing="6">
  61. <Button Content="Pop" Click="OnPop" HorizontalAlignment="Stretch" />
  62. <Button Content="Pop to Root" Click="OnPopToRoot" HorizontalAlignment="Stretch" />
  63. </StackPanel>
  64. <Separator />
  65. <!-- Event Log -->
  66. <DockPanel>
  67. <TextBlock DockPanel.Dock="Left" Text="Event Log" FontSize="13" FontWeight="SemiBold"
  68. VerticalAlignment="Center" />
  69. <Button DockPanel.Dock="Right" Content="Clear" Click="OnClearLog"
  70. HorizontalAlignment="Right" Padding="8,2" FontSize="11" />
  71. </DockPanel>
  72. <Border Background="{DynamicResource SystemControlBackgroundBaseLowBrush}"
  73. CornerRadius="4" Padding="8" MinHeight="100" MaxHeight="200">
  74. <ScrollViewer>
  75. <StackPanel x:Name="LogPanel" Spacing="1" />
  76. </ScrollViewer>
  77. </Border>
  78. </StackPanel>
  79. </ScrollViewer>
  80. <Border DockPanel.Dock="Right" Width="1" Background="{DynamicResource SystemControlForegroundBaseMediumLowBrush}" />
  81. <Border Margin="12"
  82. BorderBrush="{DynamicResource SystemControlForegroundBaseMediumLowBrush}"
  83. BorderThickness="1"
  84. CornerRadius="6"
  85. ClipToBounds="True">
  86. <NavigationPage x:Name="DemoNav" />
  87. </Border>
  88. </DockPanel>
  89. </UserControl>