atomui/Samples/AtomUI.Demo.Desktop/ShowCase/MenuShowCase.axaml

185 lines
10 KiB
Plaintext
Raw Normal View History

<UserControl
x:Class="AtomUI.Demo.Desktop.ShowCase.MenuShowCase"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:atom="https://atomui.net"
xmlns:showcase="clr-namespace:AtomUI.Demo.Desktop.ShowCase"
mc:Ignorable="d">
<showcase:ShowCasePanel>
2024-07-26 14:47:47 +08:00
<showcase:ShowCaseItem
Title="Basic"
Description="Simplest Usage.">
<atom:Menu>
<atom:MenuItem Header="_File">
2024-07-26 18:02:38 +08:00
<atom:MenuItem Header="New Text File" InputGesture="Ctrl+N" />
<atom:MenuItem Header="New File" InputGesture="Ctrl+Alt+N" />
<atom:MenuItem Header="New Window" InputGesture="Ctrl+Shift+N" />
2024-07-25 21:12:07 +08:00
</atom:MenuItem>
2024-07-26 14:47:47 +08:00
<atom:MenuItem Header="_Edit">
<atom:MenuItem Header="Undo" InputGesture="Ctrl+Shift+Z" />
<atom:MenuSeparator />
2024-07-26 18:02:38 +08:00
<atom:MenuItem Header="Cut" InputGesture="Ctrl+X" />
2024-07-26 14:47:47 +08:00
</atom:MenuItem>
</atom:Menu>
</showcase:ShowCaseItem>
2024-07-26 18:02:38 +08:00
2024-07-26 14:47:47 +08:00
<showcase:ShowCaseItem
Title="Icon and submenu"
Description="With icon and submenu.">
<atom:Menu>
<atom:MenuItem Header="_File">
2024-07-26 18:02:38 +08:00
<atom:MenuItem Header="New Text File" InputGesture="Ctrl+N" />
<atom:MenuItem Header="New File" InputGesture="Ctrl+Alt+N" />
2024-07-26 14:47:47 +08:00
<atom:MenuItem Header="New Window" InputGesture="Ctrl+Shift+N" />
<atom:MenuSeparator />
2024-07-26 18:02:38 +08:00
<atom:MenuItem Header="Save" InputGesture="Ctrl+S" />
2024-07-26 14:47:47 +08:00
<atom:MenuItem Header="Save As..." InputGesture="Ctrl+Shift+S" />
<atom:MenuItem Header="Save All" InputGesture="Ctrl+K" />
<atom:MenuSeparator />
<atom:MenuItem Header="Exit" />
</atom:MenuItem>
<atom:MenuItem Header="_Edit">
<atom:MenuItem Header="Undo" InputGesture="Ctrl+Shift+Z" />
<atom:MenuSeparator />
<atom:MenuItem Header="Cut" InputGesture="Ctrl+X" Icon="{atom:IconProvider Kind=ScissorOutlined}" />
<atom:MenuItem Header="Copy" InputGesture="Ctrl+C" Icon="{atom:IconProvider Kind=CopyOutlined}" />
<atom:MenuItem Header="Delete" InputGesture="Ctrl+D" Icon="{atom:IconProvider Kind=DeleteOutlined}" />
<atom:MenuItem Header="Paste">
<atom:MenuItem Header="Paste" InputGesture="Ctrl+P"
Icon="{atom:IconProvider Kind=FileDoneOutlined}" />
<atom:MenuItem Header="Paste from History" InputGesture="Ctrl+Shift+V" />
</atom:MenuItem>
</atom:MenuItem>
</atom:Menu>
</showcase:ShowCaseItem>
<showcase:ShowCaseItem
Title="menu item with ToggleType"
Description="Renders a checkbox or radio button on a menu.">
<atom:Menu>
<atom:MenuItem Header="_Menu A">
<atom:MenuItem Header="New Text File" InputGesture="Ctrl+N" ToggleType="Radio" GroupName="Group1" />
<atom:MenuItem Header="New File" InputGesture="Ctrl+Alt+N" ToggleType="Radio" GroupName="Group1" />
<atom:MenuItem Header="New Window" InputGesture="Ctrl+Shift+N" ToggleType="Radio"
GroupName="Group1" />
<atom:MenuSeparator />
<atom:MenuItem Header="Save" InputGesture="Ctrl+S" ToggleType="CheckBox" />
<atom:MenuItem Header="Save As..." InputGesture="Ctrl+Shift+S" ToggleType="CheckBox"
Icon="{atom:IconProvider Kind=GithubOutlined}" />
<atom:MenuItem Header="Save All" InputGesture="Ctrl+K" ToggleType="CheckBox"
Icon="{atom:IconProvider Kind=CheckOutlined}" />
<atom:MenuSeparator />
<atom:MenuItem Header="Exit" />
</atom:MenuItem>
</atom:Menu>
</showcase:ShowCaseItem>
2024-07-26 18:02:38 +08:00
2024-07-26 14:47:47 +08:00
<showcase:ShowCaseItem
Title="Scrollable menu"
Description="When there are too many menu items, up and down scroll buttons will appear.">
<atom:Menu>
<atom:MenuItem Header="_Menu">
<atom:MenuItem Header="Menu Item" />
<atom:MenuItem Header="Menu Item" />
<atom:MenuItem Header="Menu Item" />
<atom:MenuItem Header="Menu Item" />
<atom:MenuItem Header="Menu Item" />
<atom:MenuItem Header="Menu Item" />
<atom:MenuItem Header="Menu Item" />
<atom:MenuItem Header="Menu Item" />
<atom:MenuItem Header="Menu Item" />
<atom:MenuItem Header="Menu Item" />
<atom:MenuItem Header="Menu Item" />
<atom:MenuItem Header="Menu Item" />
<atom:MenuItem Header="Menu Item" />
<atom:MenuItem Header="Menu Item" />
<atom:MenuItem Header="Menu Item" />
<atom:MenuItem Header="Menu Item" />
<atom:MenuItem Header="Menu Item" />
<atom:MenuItem Header="Menu Item" />
<atom:MenuItem Header="Menu Item" />
<atom:MenuItem Header="Menu Item" />
<atom:MenuItem Header="Menu Item" />
<atom:MenuItem Header="Menu Item" />
<atom:MenuItem Header="Menu Item" />
<atom:MenuItem Header="Menu Item" />
<atom:MenuItem Header="Menu Item" />
<atom:MenuItem Header="Menu Item" />
<atom:MenuItem Header="Menu Item" />
<atom:MenuItem Header="Menu Item" />
<atom:MenuItem Header="Menu Item" />
<atom:MenuItem Header="Menu Item" />
<atom:MenuItem Header="Menu Item" />
<atom:MenuItem Header="Menu Item" />
<atom:MenuItem Header="Menu Item" />
<atom:MenuItem Header="Menu Item" />
<atom:MenuItem Header="Menu Item" />
<atom:MenuItem Header="Menu Item" />
</atom:MenuItem>
</atom:Menu>
</showcase:ShowCaseItem>
2024-07-26 18:02:38 +08:00
<showcase:ShowCaseItem
2024-07-26 21:25:52 +08:00
Title="Context menu"
Description="Right click to bring up the context menu.">
2024-07-26 18:02:38 +08:00
<showcase:ShowCaseItem.Styles>
<Style Selector="Border#contextMenuContainer">
<Setter Property="BorderBrush" Value="Gray"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="CornerRadius" Value="6"/>
<Setter Property="Padding" Value="10"/>
<Setter Property="Margin" Value="10"/>
</Style>
</showcase:ShowCaseItem.Styles>
<Border Name="contextMenuContainer">
<Border.ContextMenu>
<atom:ContextMenu>
<atom:MenuItem Header="Cut" InputGesture="Ctrl+X" Icon="{atom:IconProvider Kind=ScissorOutlined}" />
<atom:MenuItem Header="Copy" InputGesture="Ctrl+C" Icon="{atom:IconProvider Kind=CopyOutlined}" />
<atom:MenuItem Header="Delete" InputGesture="Ctrl+D" Icon="{atom:IconProvider Kind=DeleteOutlined}" />
<atom:MenuItem Header="Paste">
<atom:MenuItem Header="Paste" InputGesture="Ctrl+P"
Icon="{atom:IconProvider Kind=FileDoneOutlined}" />
<atom:MenuItem Header="Paste from History" InputGesture="Ctrl+Shift+V" />
</atom:MenuItem>
</atom:ContextMenu>
</Border.ContextMenu>
<TextBlock Text="Right Click to show Context Menu" />
</Border>
</showcase:ShowCaseItem>
2024-07-26 21:25:52 +08:00
<showcase:ShowCaseItem
Title="Menu Flyout"
Description="Right Click to show Context Flyout">
<showcase:ShowCaseItem.Styles>
<Style Selector="Border#contextFlyoutContainer">
<Setter Property="BorderBrush" Value="Gray"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="CornerRadius" Value="6"/>
<Setter Property="Padding" Value="10"/>
<Setter Property="Margin" Value="10"/>
</Style>
</showcase:ShowCaseItem.Styles>
<Border Name="contextFlyoutContainer">
<Border.ContextFlyout>
<atom:MenuFlyout>
<atom:MenuItem Header="Cut" InputGesture="Ctrl+X" Icon="{atom:IconProvider Kind=ScissorOutlined}" />
<atom:MenuItem Header="Copy" InputGesture="Ctrl+C" Icon="{atom:IconProvider Kind=CopyOutlined}" />
<atom:MenuItem Header="Delete" InputGesture="Ctrl+D" Icon="{atom:IconProvider Kind=DeleteOutlined}" />
<atom:MenuItem Header="Paste">
<atom:MenuItem Header="Paste" InputGesture="Ctrl+P"
Icon="{atom:IconProvider Kind=FileDoneOutlined}" />
<atom:MenuItem Header="Paste from History" InputGesture="Ctrl+Shift+V" />
</atom:MenuItem>
</atom:MenuFlyout>
</Border.ContextFlyout>
<TextBlock Text="Right Click to show Context Flyout" />
</Border>
</showcase:ShowCaseItem>
2024-07-26 18:02:38 +08:00
</showcase:ShowCasePanel>
</UserControl>