atomui/samples/AtomUI.Demo.Desktop/ShowCase/MenuShowCase.axaml
2024-07-30 10:14:09 +08:00

187 lines
10 KiB
XML

<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>
<showcase:ShowCaseItem
Title="Basic"
Description="Simplest Usage.">
<atom:Menu>
<atom:MenuItem Header="_File">
<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" />
</atom:MenuItem>
<atom:MenuItem Header="_Edit">
<atom:MenuItem Header="Undo" InputGesture="Ctrl+Shift+Z" />
<atom:MenuSeparator />
<atom:MenuItem Header="Cut" InputGesture="Ctrl+X" />
</atom:MenuItem>
<atom:MenuItem Header="Disabled Item" IsEnabled="False" />
</atom:Menu>
</showcase:ShowCaseItem>
<showcase:ShowCaseItem
Title="Icon and submenu"
Description="With icon and submenu.">
<atom:Menu>
<atom:MenuItem Header="_File">
<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" />
<atom:MenuSeparator />
<atom:MenuItem Header="Save" InputGesture="Ctrl+S" />
<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 Header="Disabled" IsEnabled="False"/>
</atom:MenuItem>
</atom:Menu>
</showcase:ShowCaseItem>
<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>
<showcase:ShowCaseItem
Title="Context menu"
Description="Right click to bring up the context menu.">
<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>
<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>
</showcase:ShowCasePanel>
</UserControl>