| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <UserControl xmlns="https://github.com/avaloniaui">
- <StackPanel Orientation="Vertical" Spacing="4">
- <TextBlock Classes="h1">Menu</TextBlock>
- <TextBlock Classes="h2">A window menu</TextBlock>
- <StackPanel Orientation="Horizontal"
- Margin="0,16,0,0"
- HorizontalAlignment="Center"
- Spacing="16">
- <StackPanel>
- <TextBlock Classes="h3" Margin="4 8">Defined in XAML</TextBlock>
- <Menu>
- <MenuItem Header="_First">
- <MenuItem Header="Standard _Menu Item"/>
- <Separator/>
- <MenuItem Header="Menu with _Submenu">
- <MenuItem Header="Submenu _1"/>
- <MenuItem Header="Submenu _2"/>
- </MenuItem>
- <MenuItem Header="Menu Item with _Icon">
- <MenuItem.Icon>
- <Image Source="resm:ControlCatalog.Assets.github_icon.png"/>
- </MenuItem.Icon>
- </MenuItem>
- <MenuItem Header="Menu Item with _Checkbox">
- <MenuItem.Icon>
- <CheckBox BorderThickness="0" IsHitTestVisible="False" IsChecked="True"/>
- </MenuItem.Icon>
- </MenuItem>
- </MenuItem>
- <MenuItem Header="_Second">
- <MenuItem Header="Second _Menu Item"/>
- </MenuItem>
- </Menu>
- </StackPanel>
- <StackPanel>
- <TextBlock Classes="h3" Margin="4 8">Dyanamically generated</TextBlock>
- <Menu Items="{Binding MenuItems}">
- <Menu.Styles>
- <Style Selector="MenuItem">
- <Setter Property="Header" Value="{Binding Header}"/>
- <Setter Property="Items" Value="{Binding Items}"/>
- <Setter Property="Command" Value="{Binding Command}"/>
- <Setter Property="CommandParameter" Value="{Binding CommandParameter}"/>
- </Style>
- </Menu.Styles>
- </Menu>
- </StackPanel>
- </StackPanel>
- </StackPanel>
- </UserControl>
|