MenuFlyoutItem
An item of a Fluent menu: in a ContextMenu, a
MenuBarItem, a
DropDownButton or a
SplitButton.
Give it items to make it open a submenu instead of acting on click.
Example:
fluent.MenuFlyoutItem(
"Copy",
leading=fluent.FluentIcons.COPY,
trailing="Ctrl+C",
on_click=copy,
)
Inherits: Control
Properties
close_on_click- Whether clicking this item closes the menu.content- The label of this item.items- The items of a submenu that opens when this item is hovered or clicked:MenuFlyoutItem,ToggleMenuFlyoutItem,RadioMenuFlyoutItemandMenuFlyoutSeparatorcontrols.leading- An icon or control shown beforecontent.selected- Whether this item is highlighted as selected.trailing- Text or a control shown at the end of this item, typically a keyboard shortcut such as"Ctrl+C".
Events
on_click- Called when this item is clicked.
Properties
close_on_clickclass-attributeinstance-attribute
close_on_click: bool = TrueWhether clicking this item closes the menu.
itemsclass-attributeinstance-attribute
items: list[Control] = field(default_factory=list)The items of a submenu that opens when this item is hovered or clicked:
MenuFlyoutItem,
ToggleMenuFlyoutItem,
RadioMenuFlyoutItem and
MenuFlyoutSeparator controls.
leadingclass-attributeinstance-attribute
leading: IconDataOrControl | None = NoneAn icon or control shown before content.
When an item of a menu has one, the labels of the other items are indented to line up with it.
selectedclass-attributeinstance-attribute
selected: bool = FalseWhether this item is highlighted as selected.
trailingclass-attributeinstance-attribute
trailing: StrOrControl | None = NoneText or a control shown at the end of this item, typically a keyboard
shortcut such as "Ctrl+C".
Items with items show a chevron instead.
Events
on_clickclass-attributeinstance-attribute
on_click: ControlEventHandler[MenuFlyoutItem] | None = (
None
)Called when this item is clicked.