CommandBarEventsPage.xaml 5.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <UserControl xmlns="https://github.com/avaloniaui"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. x:Class="ControlCatalog.Pages.CommandBarEventsPage">
  4. <UserControl.Resources>
  5. <StreamGeometry x:Key="AddIcon">M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z</StreamGeometry>
  6. <StreamGeometry x:Key="SaveIcon">M15,9H5V5H15M12,19A3,3 0 0,1 9,16A3,3 0 0,1 12,13A3,3 0 0,1 15,16A3,3 0 0,1 12,19M17,3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V7L17,3Z</StreamGeometry>
  7. <StreamGeometry x:Key="ShareIcon">M18,16.08C17.24,16.08 16.56,16.38 16.04,16.85L8.91,12.7C8.96,12.47 9,12.24 9,12C9,11.76 8.96,11.53 8.91,11.3L15.96,7.19C16.5,7.69 17.21,8 18,8A3,3 0 0,0 21,5A3,3 0 0,0 18,2A3,3 0 0,0 15,5C15,5.24 15.04,5.47 15.09,5.7L8.04,9.81C7.5,9.31 6.79,9 6,9A3,3 0 0,0 3,12A3,3 0 0,0 6,15C6.79,15 7.5,14.69 8.04,14.19L15.16,18.34C15.11,18.55 15.08,18.77 15.08,19C15.08,20.61 16.39,21.91 18,21.91C19.61,21.91 20.92,20.61 20.92,19C20.92,17.39 19.61,16.08 18,16.08Z</StreamGeometry>
  8. <StreamGeometry x:Key="ExportIcon">M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20M16,11V18.1L13.9,16L11.1,18.8L8.3,16L11.1,13.2L9,11.1L16,11Z</StreamGeometry>
  9. <StreamGeometry x:Key="DeleteIcon">M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z</StreamGeometry>
  10. </UserControl.Resources>
  11. <DockPanel>
  12. <ScrollViewer DockPanel.Dock="Right" Width="280">
  13. <StackPanel Margin="12" Spacing="8">
  14. <TextBlock Text="Actions" FontWeight="SemiBold" FontSize="16"
  15. Foreground="{DynamicResource SystemControlHighlightAccentBrush}" />
  16. <CheckBox x:Name="IsOpenCheck"
  17. Content="IsOpen"
  18. IsCheckedChanged="OnIsOpenChanged" />
  19. <Button Content="+ Add Primary"
  20. HorizontalAlignment="Stretch"
  21. Click="OnAddPrimary" />
  22. <Button Content="- Remove Primary"
  23. HorizontalAlignment="Stretch"
  24. Click="OnRemovePrimary" />
  25. <Button Content="+ Add Secondary"
  26. HorizontalAlignment="Stretch"
  27. Click="OnAddSecondary" />
  28. <Button Content="- Remove Secondary"
  29. HorizontalAlignment="Stretch"
  30. Click="OnRemoveSecondary" />
  31. <Button Content="Clear Log"
  32. HorizontalAlignment="Stretch"
  33. Click="OnClearLog" />
  34. <Separator />
  35. <TextBlock Text="State" FontWeight="SemiBold" />
  36. <TextBlock x:Name="StateText"
  37. FontSize="12"
  38. Opacity="0.7"
  39. TextWrapping="Wrap" />
  40. <Separator />
  41. <TextBlock Text="About" FontWeight="SemiBold" />
  42. <TextBlock FontSize="12" Opacity="0.7" TextWrapping="Wrap"
  43. Text="Opening/Opened fire when the overflow opens. Closing/Closed fire when it closes. The log also records item clicks and command execution while the state panel reflects IsOpen, HasSecondaryCommands, and IsOverflowButtonVisible in real time." />
  44. </StackPanel>
  45. </ScrollViewer>
  46. <Border DockPanel.Dock="Right" Width="1" Background="{DynamicResource SystemControlForegroundBaseMediumLowBrush}" />
  47. <ScrollViewer>
  48. <StackPanel Spacing="12" Margin="12,12,12,0">
  49. <TextBlock Classes="h2">Observe CommandBar overflow events, item invocation, and state changes while opening, closing, and editing the primary and secondary command sets.</TextBlock>
  50. <CommandBar x:Name="DemoBar"
  51. OverflowButtonVisibility="Auto">
  52. <CommandBar.PrimaryCommands>
  53. <CommandBarButton Label="New"><CommandBarButton.Icon><PathIcon Data="{StaticResource AddIcon}" /></CommandBarButton.Icon></CommandBarButton>
  54. <CommandBarButton Label="Save"><CommandBarButton.Icon><PathIcon Data="{StaticResource SaveIcon}" /></CommandBarButton.Icon></CommandBarButton>
  55. <CommandBarButton Label="Share"><CommandBarButton.Icon><PathIcon Data="{StaticResource ShareIcon}" /></CommandBarButton.Icon></CommandBarButton>
  56. </CommandBar.PrimaryCommands>
  57. <CommandBar.SecondaryCommands>
  58. <CommandBarButton Label="Export"><CommandBarButton.Icon><PathIcon Data="{StaticResource ExportIcon}" /></CommandBarButton.Icon></CommandBarButton>
  59. <CommandBarButton Label="Delete"><CommandBarButton.Icon><PathIcon Data="{StaticResource DeleteIcon}" /></CommandBarButton.Icon></CommandBarButton>
  60. </CommandBar.SecondaryCommands>
  61. </CommandBar>
  62. <Border BorderBrush="{DynamicResource SystemControlForegroundBaseMediumLowBrush}"
  63. BorderThickness="1"
  64. CornerRadius="6"
  65. Padding="10">
  66. <StackPanel Spacing="6">
  67. <TextBlock Text="Event Log" FontWeight="SemiBold" />
  68. <TextBlock x:Name="EventLogText"
  69. FontFamily="Consolas, Menlo, monospace"
  70. FontSize="12"
  71. TextWrapping="Wrap"
  72. MinHeight="140"
  73. Opacity="0.8"
  74. Text="Ready" />
  75. </StackPanel>
  76. </Border>
  77. </StackPanel>
  78. </ScrollViewer>
  79. </DockPanel>
  80. </UserControl>