mirror of
https://gitee.com/chinware/atomui.git
synced 2024-12-02 11:57:42 +08:00
fc7db44fd5
BugFix: Fixed the issue that MenuPopup does not close normally
192 lines
10 KiB
XML
192 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:desktop="clr-namespace:AtomUI.Demo.Desktop"
|
|
|
|
mc:Ignorable="d">
|
|
<desktop:ShowCasePanel>
|
|
<desktop: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>
|
|
</desktop:ShowCaseItem>
|
|
|
|
<desktop: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>
|
|
</desktop:ShowCaseItem>
|
|
|
|
<desktop: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>
|
|
</desktop:ShowCaseItem>
|
|
|
|
<desktop: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>
|
|
</desktop:ShowCaseItem>
|
|
|
|
<desktop:ShowCaseItem
|
|
Title="Context menu"
|
|
Description="Right click to bring up the context menu.">
|
|
<desktop: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>
|
|
</desktop: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>
|
|
</desktop:ShowCaseItem>
|
|
|
|
<desktop:ShowCaseItem
|
|
Title="Menu Flyout"
|
|
Description="Right Click to show Context Flyout">
|
|
<desktop: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>
|
|
</desktop: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>
|
|
|
|
</desktop:ShowCaseItem>
|
|
|
|
</desktop:ShowCasePanel>
|
|
</UserControl> |