DrawerPageCustomizationPage.xaml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <UserControl xmlns="https://github.com/avaloniaui"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. x:Class="ControlCatalog.Pages.DrawerPageCustomizationPage">
  4. <DockPanel>
  5. <ScrollViewer DockPanel.Dock="Right" Width="280">
  6. <StackPanel Margin="12" Spacing="8">
  7. <TextBlock Text="Configuration" FontWeight="SemiBold" FontSize="16"
  8. Foreground="{DynamicResource SystemControlHighlightAccentBrush}" />
  9. <TextBlock Text="Actions" FontSize="13" FontWeight="SemiBold" />
  10. <Button Content="Toggle Drawer" Click="OnToggleDrawer" HorizontalAlignment="Stretch" />
  11. <Separator />
  12. <TextBlock Text="Behavior" FontSize="13" FontWeight="SemiBold" />
  13. <ComboBox x:Name="BehaviorCombo" SelectedIndex="0"
  14. SelectionChanged="OnBehaviorChanged" HorizontalAlignment="Stretch">
  15. <ComboBoxItem Content="Default" />
  16. <ComboBoxItem Content="Flyout" />
  17. <ComboBoxItem Content="Locked" />
  18. <ComboBoxItem Content="Disabled" />
  19. </ComboBox>
  20. <TextBlock Text="Layout" FontSize="12" Opacity="0.7" />
  21. <ComboBox x:Name="LayoutCombo" SelectedIndex="0"
  22. SelectionChanged="OnLayoutChanged" HorizontalAlignment="Stretch">
  23. <ComboBoxItem Content="Overlay" />
  24. <ComboBoxItem Content="Split" />
  25. <ComboBoxItem Content="CompactOverlay" />
  26. <ComboBoxItem Content="CompactInline" />
  27. </ComboBox>
  28. <TextBlock Text="Placement" FontSize="12" Opacity="0.7" />
  29. <ComboBox x:Name="PlacementCombo" SelectedIndex="0"
  30. SelectionChanged="OnPlacementChanged" HorizontalAlignment="Stretch">
  31. <ComboBoxItem Content="Left" />
  32. <ComboBoxItem Content="Right" />
  33. <ComboBoxItem Content="Top" />
  34. <ComboBoxItem Content="Bottom" />
  35. </ComboBox>
  36. <CheckBox x:Name="GestureCheck" Content="Gesture Enabled" IsChecked="True" Click="OnGestureToggled" />
  37. <Separator />
  38. <TextBlock Text="Appearance" FontSize="13" FontWeight="SemiBold" />
  39. <TextBlock Text="Drawer Length" FontSize="12" Opacity="0.7" />
  40. <StackPanel Orientation="Horizontal" Spacing="8">
  41. <Slider x:Name="DrawerLengthSlider" Minimum="150" Maximum="400" Value="260"
  42. Width="150" ValueChanged="OnDrawerLengthChanged" />
  43. <TextBlock x:Name="DrawerLengthText" Text="260" VerticalAlignment="Center" />
  44. </StackPanel>
  45. <TextBlock Text="Drawer Background" FontSize="12" Opacity="0.7" />
  46. <ComboBox x:Name="DrawerBgCombo" SelectedIndex="0"
  47. SelectionChanged="OnDrawerBgChanged" HorizontalAlignment="Stretch">
  48. <ComboBoxItem Content="Default" />
  49. <ComboBoxItem Content="SlateBlue" />
  50. <ComboBoxItem Content="DarkCyan" />
  51. <ComboBoxItem Content="DarkRed" />
  52. <ComboBoxItem Content="DarkGreen" />
  53. </ComboBox>
  54. <TextBlock Text="Header Background" FontSize="12" Opacity="0.7" />
  55. <ComboBox x:Name="HeaderBgCombo" SelectedIndex="0"
  56. SelectionChanged="OnHeaderBgChanged" HorizontalAlignment="Stretch">
  57. <ComboBoxItem Content="Accent" />
  58. <ComboBoxItem Content="DodgerBlue" />
  59. <ComboBoxItem Content="Orange" />
  60. <ComboBoxItem Content="Teal" />
  61. <ComboBoxItem Content="Purple" />
  62. </ComboBox>
  63. <TextBlock Text="Header Template" FontSize="12" Opacity="0.7" />
  64. <ComboBox x:Name="HeaderTemplateCombo" SelectedIndex="0"
  65. SelectionChanged="OnHeaderTemplateChanged" HorizontalAlignment="Stretch">
  66. <ComboBoxItem Content="None (direct control)" />
  67. <ComboBoxItem Content="Banner" />
  68. <ComboBoxItem Content="Avatar card" />
  69. </ComboBox>
  70. <TextBlock Text="Footer Background" FontSize="12" Opacity="0.7" />
  71. <ComboBox x:Name="FooterBgCombo" SelectedIndex="0"
  72. SelectionChanged="OnFooterBgChanged" HorizontalAlignment="Stretch">
  73. <ComboBoxItem Content="None" />
  74. <ComboBoxItem Content="DimGray" />
  75. <ComboBoxItem Content="DarkSlateBlue" />
  76. <ComboBoxItem Content="DarkOliveGreen" />
  77. <ComboBoxItem Content="Maroon" />
  78. </ComboBox>
  79. <TextBlock Text="Footer Template" FontSize="12" Opacity="0.7" />
  80. <ComboBox x:Name="FooterTemplateCombo" SelectedIndex="0"
  81. SelectionChanged="OnFooterTemplateChanged" HorizontalAlignment="Stretch">
  82. <ComboBoxItem Content="None (direct control)" />
  83. <ComboBoxItem Content="Version badge" />
  84. <ComboBoxItem Content="Icon + label" />
  85. </ComboBox>
  86. <TextBlock Text="Drawer Icon" FontSize="12" Opacity="0.7" />
  87. <ComboBox x:Name="IconCombo" SelectedIndex="0"
  88. SelectionChanged="OnIconChanged" HorizontalAlignment="Stretch">
  89. <ComboBoxItem Content="3 lines" />
  90. <ComboBoxItem Content="2 lines" />
  91. <ComboBoxItem Content="4 squares" />
  92. </ComboBox>
  93. <TextBlock Text="Backdrop" FontSize="12" Opacity="0.7" />
  94. <ComboBox x:Name="BackdropCombo" SelectedIndex="0"
  95. SelectionChanged="OnBackdropChanged" HorizontalAlignment="Stretch">
  96. <ComboBoxItem Content="None" />
  97. <ComboBoxItem Content="Dark 40%" />
  98. <ComboBoxItem Content="Dark 70%" />
  99. <ComboBoxItem Content="Light 40%" />
  100. </ComboBox>
  101. <Separator />
  102. <TextBlock Text="Visibility" FontSize="13" FontWeight="SemiBold" />
  103. <CheckBox x:Name="ShowHeaderCheck" Content="Show Header" IsChecked="True" Click="OnShowHeaderToggled" />
  104. <CheckBox x:Name="ShowFooterCheck" Content="Show Footer" IsChecked="True" Click="OnShowFooterToggled" />
  105. </StackPanel>
  106. </ScrollViewer>
  107. <Border DockPanel.Dock="Right" Width="1" Background="{DynamicResource SystemControlForegroundBaseMediumLowBrush}" />
  108. <Border Margin="12"
  109. BorderBrush="{DynamicResource SystemControlForegroundBaseMediumLowBrush}"
  110. BorderThickness="1"
  111. CornerRadius="6"
  112. ClipToBounds="True">
  113. <DrawerPage x:Name="DemoDrawer"
  114. Header="Customization"
  115. DrawerLength="260"
  116. DrawerHeaderBackground="{DynamicResource SystemControlHighlightAccentBrush}">
  117. <DrawerPage.DrawerIconTemplate>
  118. <DataTemplate DataType="Geometry">
  119. <PathIcon Data="{Binding}" />
  120. </DataTemplate>
  121. </DrawerPage.DrawerIconTemplate>
  122. <DrawerPage.DrawerHeader>
  123. <Border x:Name="DrawerHeaderBorder" Padding="16">
  124. <StackPanel Spacing="4">
  125. <TextBlock Text="Menu" FontSize="20" FontWeight="Bold" Foreground="White" />
  126. <TextBlock Text="Navigation drawer" FontSize="12" Foreground="White" Opacity="0.7" />
  127. </StackPanel>
  128. </Border>
  129. </DrawerPage.DrawerHeader>
  130. <DrawerPage.Drawer>
  131. <StackPanel Margin="8" Spacing="4">
  132. <Button HorizontalAlignment="Stretch" Background="Transparent"
  133. Click="OnMenuItemClick" Tag="Home">
  134. <StackPanel Orientation="Horizontal" Spacing="8">
  135. <PathIcon Width="16" Height="16" Data="M10,20V14H14V20H19V12H22L12,3L2,12H5V20H10Z" />
  136. <TextBlock Text="Home" VerticalAlignment="Center" />
  137. </StackPanel>
  138. </Button>
  139. <Button HorizontalAlignment="Stretch" Background="Transparent"
  140. Click="OnMenuItemClick" Tag="Profile">
  141. <StackPanel Orientation="Horizontal" Spacing="8">
  142. <PathIcon Width="16" Height="16" Data="M12,4A4,4 0 0,1 16,8A4,4 0 0,1 12,12A4,4 0 0,1 8,8A4,4 0 0,1 12,4M12,14C16.42,14 20,15.79 20,18V20H4V18C4,15.79 7.58,14 12,14Z" />
  143. <TextBlock Text="Profile" VerticalAlignment="Center" />
  144. </StackPanel>
  145. </Button>
  146. <Button HorizontalAlignment="Stretch" Background="Transparent"
  147. Click="OnMenuItemClick" Tag="Settings">
  148. <StackPanel Orientation="Horizontal" Spacing="8">
  149. <PathIcon Width="16" Height="16" Data="M12,15.5A3.5,3.5 0 0,1 8.5,12A3.5,3.5 0 0,1 12,8.5A3.5,3.5 0 0,1 15.5,12A3.5,3.5 0 0,1 12,15.5M19.43,12.97C19.47,12.65 19.5,12.33 19.5,12C19.5,11.67 19.47,11.34 19.43,11L21.54,9.37C21.73,9.22 21.78,8.95 21.66,8.73L19.66,5.27C19.54,5.05 19.27,4.96 19.05,5.05L16.56,6.05C16.04,5.66 15.5,5.32 14.87,5.07L14.5,2.42C14.46,2.18 14.25,2 14,2H10C9.75,2 9.54,2.18 9.5,2.42L9.13,5.07C8.5,5.32 7.96,5.66 7.44,6.05L4.95,5.05C4.73,4.96 4.46,5.05 4.34,5.27L2.34,8.73C2.21,8.95 2.27,9.22 2.46,9.37L4.57,11C4.53,11.34 4.5,11.67 4.5,12C4.5,12.33 4.53,12.65 4.57,12.97L2.46,14.63C2.27,14.78 2.21,15.05 2.34,15.27L4.34,18.73C4.46,18.95 4.73,19.04 4.95,18.95L7.44,17.94C7.96,18.34 8.5,18.68 9.13,18.93L9.5,21.58C9.54,21.82 9.75,22 10,22H14C14.25,22 14.46,21.82 14.5,21.58L14.87,18.93C15.5,18.68 16.04,18.34 16.56,17.94L19.05,18.95C19.27,19.04 19.54,18.95 19.66,18.73L21.66,15.27C21.78,15.05 21.73,14.78 21.54,14.63L19.43,12.97Z" />
  150. <TextBlock Text="Settings" VerticalAlignment="Center" />
  151. </StackPanel>
  152. </Button>
  153. </StackPanel>
  154. </DrawerPage.Drawer>
  155. <DrawerPage.Content>
  156. <ContentPage Header="Detail">
  157. <StackPanel Margin="16" Spacing="8">
  158. <TextBlock x:Name="DetailTitleText" Text="Home" FontSize="24" FontWeight="Bold" />
  159. <TextBlock x:Name="DetailDescriptionText"
  160. Text="Use the configuration panel to customize drawer behavior and appearance."
  161. TextWrapping="Wrap" />
  162. </StackPanel>
  163. </ContentPage>
  164. </DrawerPage.Content>
  165. <DrawerPage.DrawerFooter>
  166. <Border x:Name="DrawerFooterBorder" Padding="16">
  167. <StackPanel Spacing="2">
  168. <TextBlock Text="Avalonia" FontSize="12" FontWeight="SemiBold" Opacity="0.6" />
  169. <TextBlock Text="v1.0.0" FontSize="11" Opacity="0.4" />
  170. </StackPanel>
  171. </Border>
  172. </DrawerPage.DrawerFooter>
  173. </DrawerPage>
  174. </Border>
  175. </DockPanel>
  176. </UserControl>