A custom menu flyout control that provides additional functionality and styling options over the standard Avalonia MenuFlyout. Uses a custom presenter for enhanced theming and behavior with the PleasantUI design system.
<Button Content="Show Menu">
<Button.Flyout>
<flyout:PleasantMenuFlyout>
<MenuItem Header="Copy" />
<MenuItem Header="Paste" />
<Separator />
<MenuItem Header="Settings" />
</flyout:PleasantMenuFlyout>
</Button.Flyout>
</Button>Inherits all properties from Avalonia.Controls.MenuFlyout:
Items- The menu items collectionIsOpen- Whether the flyout is currently openPlacement- Where the flyout should be positioned relative to its targetShowMode- How the flyout should be shownItemTemplate- Data template for menu itemsItemContainerTheme- Theme for item containers- And other standard MenuFlyout properties
Control where the menu appears:
<PleasantMenuFlyout Placement="Bottom">
<!-- Menu items -->
</PleasantMenuFlyout>Control how the flyout is shown:
<PleasantMenuFlyout ShowMode="Standard" />var flyout = new PleasantMenuFlyout
{
Items = new AvaloniaList<object>
{
new MenuItem { Header = "Copy" },
new MenuItem { Header = "Paste" }
}
};
flyout.ShowAt(targetControl);
flyout.Hide();<Button Content="File">
<Button.Flyout>
<flyout:PleasantMenuFlyout>
<MenuItem Header="New" InputGesture="Ctrl+N" />
<MenuItem Header="Open" InputGesture="Ctrl+O" />
<Separator />
<MenuItem Header="Save" InputGesture="Ctrl+S" />
<MenuItem Header="Save As" InputGesture="Ctrl+Shift+S" />
<Separator />
<MenuItem Header="Exit" />
</flyout:PleasantMenuFlyout>
</Button.Flyout>
</Button>PleasantMenuFlyoutuses a custom presenter (PleasantMenuFlyoutPresenter) for consistent theming with the PleasantUI design system- All standard Avalonia MenuFlyout functionality is preserved