ContextMenu Class

A control context menu.

Definition

Namespace: Avalonia.Controls
Assembly: Avalonia.Controls (in Avalonia.Controls.dll) Version: 11.3.999
public class ContextMenu : MenuBase, 
	ISetterValue, IPopupHostProvider
Inheritance
Object    AvaloniaObject    Animatable    StyledElement    Visual    Layoutable    Interactive    InputElement    Control    TemplatedControl    ItemsControl    SelectingItemsControl    MenuBase    ContextMenu
Implements
IPopupHostProvider, ISetterValue

Constructors

ContextMenu Initializes a new instance of the ContextMenu class.
ContextMenu(IMenuInteractionHandler) Initializes a new instance of the ContextMenu class.

Properties

ActualThemeVariant
(Inherited from StyledElement)
AlwaysSelected Gets a value indicating whether AlwaysSelected is set.
(Inherited from SelectingItemsControl)
AutoScrollToSelectedItem Gets or sets a value indicating whether to automatically scroll to newly selected items.
(Inherited from SelectingItemsControl)
Background Gets or sets the brush used to draw the control's background.
(Inherited from TemplatedControl)
BackgroundSizing Gets or sets how the control's background is drawn relative to the control's border.
(Inherited from TemplatedControl)
BorderBrush Gets or sets the brush used to draw the control's border.
(Inherited from TemplatedControl)
BorderThickness Gets or sets the thickness of the control's border.
(Inherited from TemplatedControl)
Bounds
(Inherited from Visual)
BypassFlowDirectionPolicies
(Inherited from Visual)
Classes
(Inherited from StyledElement)
Clip
(Inherited from Visual)
ClipToBounds
(Inherited from Visual)
ContextFlyout Gets or sets a context flyout to the control
(Inherited from Control)
ContextMenu Gets or sets a context menu to the control.
(Inherited from Control)
CornerRadius Gets or sets the radius of the border rounded corners.
(Inherited from TemplatedControl)
Cursor
(Inherited from InputElement)
CustomPopupPlacementCallback Gets or sets a delegate handler method that positions the Popup control, when Placement is set to Custom.
DataContext
(Inherited from StyledElement)
DataTemplates Gets or sets the data templates for the control.
(Inherited from Control)
DesiredSize
(Inherited from Layoutable)
DisplayMemberBinding Gets or sets the IBinding to use for binding to the display member of each item.
(Inherited from ItemsControl)
Effect
(Inherited from Visual)
FlowDirection
(Inherited from Visual)
Focusable
(Inherited from InputElement)
FocusAdorner Gets or sets the control's focus adorner.
(Inherited from Control)
FontFamily Gets or sets the font family used to draw the control's text.
(Inherited from TemplatedControl)
FontFeatures Gets or sets the font features turned on/off.
(Inherited from TemplatedControl)
FontSize Gets or sets the size of the control's text in points.
(Inherited from TemplatedControl)
FontStretch Gets or sets the font stretch used to draw the control's text.
(Inherited from TemplatedControl)
FontStyle Gets or sets the font style used to draw the control's text.
(Inherited from TemplatedControl)
FontWeight Gets or sets the font weight used to draw the control's text.
(Inherited from TemplatedControl)
Foreground Gets or sets the brush used to draw the control's text and other foreground elements.
(Inherited from TemplatedControl)
GestureRecognizers
(Inherited from InputElement)
HasMirrorTransform
(Inherited from Visual)
Height
(Inherited from Layoutable)
HorizontalAlignment
(Inherited from Layoutable)
HorizontalOffset Gets or sets the Horizontal offset of the popup in relation to the PlacementTarget.
InheritanceParent
(Inherited from AvaloniaObject)
InteractionHandler Gets the interaction handler for the menu.
(Inherited from MenuBase)
IsArrangeValid
(Inherited from Layoutable)
IsEffectivelyEnabled
(Inherited from InputElement)
IsEffectivelyVisible
(Inherited from Visual)
IsEnabled
(Inherited from InputElement)
IsEnabledCore
(Inherited from InputElement)
IsFocused
(Inherited from InputElement)
IsHitTestVisible
(Inherited from InputElement)
IsInitialized
(Inherited from StyledElement)
IsKeyboardFocusWithin
(Inherited from InputElement)
IsLoaded Gets a value indicating whether the control is fully constructed in the visual tree and both layout and render are complete.
(Inherited from Control)
IsMeasureValid
(Inherited from Layoutable)
IsOpen Gets a value indicating whether the menu is open.
(Inherited from MenuBase)
IsPointerOver
(Inherited from InputElement)
IsTabStop
(Inherited from InputElement)
IsTextSearchEnabled Gets or sets a value that specifies whether a user can jump to a value by typing.
(Inherited from SelectingItemsControl)
IsVisible
(Inherited from Visual)
Item
(Inherited from AvaloniaObject)
Item
(Inherited from AvaloniaObject)
ItemContainerGenerator Gets the ItemContainerGenerator for the control.
(Inherited from ItemsControl)
ItemContainerTheme Gets or sets the ControlTheme that is applied to the container element generated for each item.
(Inherited from ItemsControl)
ItemCount Gets the number of items being displayed by the ItemsControl.
(Inherited from ItemsControl)
Items Gets the items to display.
(Inherited from ItemsControl)
ItemsPanel Gets or sets the panel used to display the items.
(Inherited from ItemsControl)
ItemsPanelRoot Gets the Panel specified by ItemsPanel.
(Inherited from ItemsControl)
ItemsSource Gets or sets a collection used to generate the content of the ItemsControl.
(Inherited from ItemsControl)
ItemsView Gets a read-only view of the items in the ItemsControl.
(Inherited from ItemsControl)
ItemTemplate Gets or sets the data template used to display the items in the control.
(Inherited from ItemsControl)
KeyBindings
(Inherited from InputElement)
LogicalChildren
(Inherited from StyledElement)
Margin
(Inherited from Layoutable)
MaxHeight
(Inherited from Layoutable)
MaxWidth
(Inherited from Layoutable)
MinHeight
(Inherited from Layoutable)
MinWidth
(Inherited from Layoutable)
Name
(Inherited from StyledElement)
Opacity
(Inherited from Visual)
OpacityMask
(Inherited from Visual)
Padding Gets or sets the padding placed between the border of the control and its content.
(Inherited from TemplatedControl)
Parent
(Inherited from StyledElement)
Placement Gets or sets the desired placement of the popup in relation to the PlacementTarget.
PlacementAnchor Gets or sets the anchor point on the PlacementRect when Placement is AnchorAndGravity.
PlacementConstraintAdjustment Gets or sets a value describing how the popup position will be adjusted if the unadjusted position would result in the popup being partly constrained.
PlacementGravity Gets or sets a value which defines in what direction the popup should open when Placement is AnchorAndGravity.
PlacementRect Gets or sets the anchor rectangle within the parent that the popup will be placed relative to when Placement is AnchorAndGravity.
PlacementTarget Gets or sets the control that is used to determine the popup's position.
Presenter Gets the items presenter control.
(Inherited from ItemsControl)
PseudoClasses
(Inherited from StyledElement)
RenderTransform
(Inherited from Visual)
RenderTransformOrigin
(Inherited from Visual)
Resources
(Inherited from StyledElement)
SelectedIndex Gets or sets the index of the selected item.
(Inherited from SelectingItemsControl)
SelectedItem Gets or sets the selected item.
(Inherited from SelectingItemsControl)
SelectedItems Gets or sets the selected items.
(Inherited from SelectingItemsControl)
SelectedValue Gets or sets the value of the selected item, obtained using SelectedValueBinding
(Inherited from SelectingItemsControl)
SelectedValueBinding Gets the IBinding instance used to obtain the SelectedValue property
(Inherited from SelectingItemsControl)
Selection Gets or sets the model that holds the current selection.
(Inherited from SelectingItemsControl)
SelectionMode Gets or sets the selection mode.
(Inherited from SelectingItemsControl)
StyleKey
(Inherited from StyledElement)
StyleKeyOverride
(Inherited from StyledElement)
Styles
(Inherited from StyledElement)
TabIndex
(Inherited from InputElement)
Tag Gets or sets a user-defined object attached to the control.
(Inherited from Control)
Template Gets or sets the template that defines the control's appearance.
(Inherited from TemplatedControl)
TemplatedParent
(Inherited from StyledElement)
Theme
(Inherited from StyledElement)
Transitions
(Inherited from Animatable)
UseLayoutRounding
(Inherited from Layoutable)
VerticalAlignment
(Inherited from Layoutable)
VerticalOffset Gets or sets the Vertical offset of the popup in relation to the PlacementTarget.
VisualChildren
(Inherited from Visual)
VisualRoot
(Inherited from Visual)
Width
(Inherited from Layoutable)
WindowManagerAddShadowHint 
WrapSelection Gets or sets a value which indicates whether to wrap around when the first or last item is reached.
(Inherited from SelectingItemsControl)
ZIndex
(Inherited from Visual)

Methods

AddHandler(RoutedEvent, Delegate, RoutingStrategies, Boolean)
(Inherited from Interactive)
AddHandler``1(RoutedEventUMP, EventHandlerUMP, RoutingStrategies, Boolean)
(Inherited from Interactive)
ApplyStyling
(Inherited from StyledElement)
ApplyTemplate
(Inherited from TemplatedControl)
Arrange(Rect)
(Inherited from Layoutable)
ArrangeCore(Rect)
(Inherited from Layoutable)
ArrangeOverride(Size)
(Inherited from Layoutable)
BeginInitSignals the object that initialization is starting.
(Inherited from SelectingItemsControl)
Bind(AvaloniaProperty, IBinding)
(Inherited from AvaloniaObject)
Bind(AvaloniaProperty, IObservableObject, BindingPriority)
(Inherited from AvaloniaObject)
Bind``1(DirectPropertyBaseUMP, IObservableUMP)
(Inherited from AvaloniaObject)
Bind``1(DirectPropertyBaseUMP, IObservableBindingValueUMP)
(Inherited from AvaloniaObject)
Bind``1(DirectPropertyBaseUMP, IObservableObject)
(Inherited from AvaloniaObject)
Bind``1(StyledPropertyUMP, IObservableUMP, BindingPriority)
(Inherited from AvaloniaObject)
Bind``1(StyledPropertyUMP, IObservableBindingValueUMP, BindingPriority)
(Inherited from AvaloniaObject)
Bind``1(StyledPropertyUMP, IObservableObject, BindingPriority)
(Inherited from AvaloniaObject)
BuildEventRoute(RoutedEvent)
(Inherited from Interactive)
CheckAccess
(Inherited from AvaloniaObject)
ClearContainerForItemOverride(Control) Undoes the effects of the PrepareContainerForItemOverride(Control, Object, Int32) method.
(Inherited from SelectingItemsControl)
ClearValue(AvaloniaProperty)
(Inherited from AvaloniaObject)
ClearValue``1(AvaloniaPropertyUMP)
(Inherited from AvaloniaObject)
ClearValue``1(DirectPropertyBaseUMP)
(Inherited from AvaloniaObject)
ClearValue``1(StyledPropertyUMP)
(Inherited from AvaloniaObject)
Close Closes the menu.
(Overrides MenuBaseClose)
CoerceValue(AvaloniaProperty)
(Inherited from AvaloniaObject)
ContainerForItemPreparedOverride(Control, Object, Int32)
(Inherited from SelectingItemsControl)
ContainerFromIndex(Int32) Returns the container for the item at the specified index.
(Inherited from ItemsControl)
ContainerFromItem(Object) Returns the container corresponding to the specified item.
(Inherited from ItemsControl)
ContainerIndexChangedOverride(Control, Int32, Int32) Called when the index for a container changes due to an insertion or removal in the items collection.
(Inherited from SelectingItemsControl)
CreateContainerForItemOverride(Object, Int32, Object)
(Inherited from MenuBase)
EndInitSignals the object that initialization is complete.
(Inherited from SelectingItemsControl)
Equals(Object)
(Inherited from AvaloniaObject)
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
Focus(NavigationMethod, KeyModifiers)
(Inherited from InputElement)
GetBaseValue``1(StyledPropertyUMP)
(Inherited from AvaloniaObject)
GetContainerFromEventSource(Object) Tries to get the container that was the source of an event.
(Inherited from SelectingItemsControl)
GetHashCode
(Inherited from AvaloniaObject)
GetRealizedContainers Gets the currently realized containers.
(Inherited from ItemsControl)
GetTemplateFocusTarget Gets the element that receives the focus adorner.
(Inherited from TemplatedControl)
GetTypeGets the Type of the current instance.
(Inherited from Object)
GetValue(AvaloniaProperty)
(Inherited from AvaloniaObject)
GetValue``1(DirectPropertyBaseUMP)
(Inherited from AvaloniaObject)
GetValue``1(StyledPropertyUMP)
(Inherited from AvaloniaObject)
IndexFromContainer(Control) Returns the index to the item that has the specified, generated container.
(Inherited from ItemsControl)
InitializeIfNeeded
(Inherited from StyledElement)
InvalidateArrange
(Inherited from Layoutable)
InvalidateMeasure
(Inherited from Layoutable)
InvalidateMirrorTransform
(Inherited from Visual)
InvalidateVisual
(Inherited from Visual)
IsAnimating(AvaloniaProperty)
(Inherited from AvaloniaObject)
IsSet(AvaloniaProperty)
(Inherited from AvaloniaObject)
ItemFromContainer(Control) Returns the item that corresponds to the specified, generated container.
(Inherited from ItemsControl)
LogicalChildrenCollectionChanged(Object, NotifyCollectionChangedEventArgs)
(Inherited from Visual)
Measure(Size)
(Inherited from Layoutable)
MeasureCore(Size)
(Inherited from Layoutable)
MeasureOverride(Size)
(Inherited from Layoutable)
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
MoveSelection(NavigationDirection, Boolean, Boolean) Moves the selection in the specified direction relative to the current selection.
(Inherited from SelectingItemsControl)
MoveSelection(Control, NavigationDirection, Boolean, Boolean) Moves the selection in the specified direction relative to the specified container.
(Inherited from SelectingItemsControl)
NeedsContainerT(Object, Object) A default implementation of NeedsContainerOverride(Object, Int32, Object) that returns true and sets the recycle key to DefaultRecycleKey if the item is not a T .
(Inherited from ItemsControl)
NeedsContainerOverride(Object, Int32, Object)
(Inherited from MenuBase)
OnAccessKey(RoutedEventArgs)
(Inherited from InputElement)
OnApplyTemplate(TemplateAppliedEventArgs) Called when the control's template is applied. In simple terms, this means the method is called just before the control is displayed.
(Inherited from SelectingItemsControl)
OnAttachedToLogicalTree(LogicalTreeAttachmentEventArgs)
(Inherited from TemplatedControl)
OnAttachedToVisualTree(VisualTreeAttachmentEventArgs)
(Inherited from MenuBase)
OnAttachedToVisualTreeCore(VisualTreeAttachmentEventArgs)
(Inherited from Control)
OnCreateAutomationPeer Returns a new, type-specific AutomationPeer implementation for the control.
(Inherited from ItemsControl)
OnDataContextBeginUpdate
(Inherited from SelectingItemsControl)
OnDataContextChanged(EventArgs)
(Inherited from StyledElement)
OnDataContextEndUpdate
(Inherited from SelectingItemsControl)
OnDetachedFromLogicalTree(LogicalTreeAttachmentEventArgs)
(Inherited from TemplatedControl)
OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs)
(Inherited from MenuBase)
OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs)
(Inherited from Control)
OnGotFocus(GotFocusEventArgs)
(Inherited from ItemsControl)
OnInitialized
(Inherited from SelectingItemsControl)
OnKeyDown(KeyEventArgs) Handles directional navigation within the ItemsControl.
(Inherited from MenuBase)
OnKeyUp(KeyEventArgs)
(Inherited from Control)
OnLoaded(RoutedEventArgs) Invoked just before the Loaded event.
(Inherited from Control)
OnLostFocus(RoutedEventArgs)
(Inherited from Control)
OnMeasureInvalidated
(Inherited from Layoutable)
OnPointerCaptureLost(PointerCaptureLostEventArgs)
(Inherited from InputElement)
OnPointerEntered(PointerEventArgs)
(Inherited from InputElement)
OnPointerExited(PointerEventArgs)
(Inherited from InputElement)
OnPointerMoved(PointerEventArgs)
(Inherited from InputElement)
OnPointerPressed(PointerPressedEventArgs)
(Inherited from InputElement)
OnPointerReleased(PointerReleasedEventArgs)
(Inherited from Control)
OnPointerWheelChanged(PointerWheelEventArgs)
(Inherited from InputElement)
OnPropertyChanged(AvaloniaPropertyChangedEventArgs)
(Overrides SelectingItemsControlOnPropertyChanged(AvaloniaPropertyChangedEventArgs))
OnPropertyChangedCore(AvaloniaPropertyChangedEventArgs)
(Inherited from Animatable)
OnSizeChanged(SizeChangedEventArgs) Invoked just before the SizeChanged event.
(Inherited from Control)
OnSubmenuOpened(RoutedEventArgs) Called when a submenu opens somewhere in the menu.
(Inherited from MenuBase)
OnTemplateChanged(AvaloniaPropertyChangedEventArgs) Called when the Template property changes.
(Inherited from TemplatedControl)
OnTextInput(TextInputEventArgs)
(Inherited from SelectingItemsControl)
OnUnloaded(RoutedEventArgs) Invoked just before the Unloaded event.
(Inherited from Control)
OnVisualParentChanged(Visual, Visual)
(Inherited from Layoutable)
Open Opens the menu.
(Overrides MenuBaseOpen)
Open(Control) Opens a context menu on the specified control.
PrepareContainerForItemOverride(Control, Object, Int32)
(Inherited from SelectingItemsControl)
RaiseEvent(RoutedEventArgs)
(Inherited from Interactive)
RaisePropertyChanged``1(DirectPropertyBaseUMP, UMP, UMP)
(Inherited from AvaloniaObject)
RefreshContainers Refreshes the containers displayed by the control.
(Inherited from ItemsControl)
RemoveHandler(RoutedEvent, Delegate)
(Inherited from Interactive)
RemoveHandler``1(RoutedEventUMP, EventHandlerUMP)
(Inherited from Interactive)
Render(DrawingContext)
(Inherited from Visual)
ScrollIntoView(Int32) Scrolls the specified item into view.
(Inherited from ItemsControl)
ScrollIntoView(Object) Scrolls the specified item into view.
(Inherited from ItemsControl)
SetAndRaise``1(DirectPropertyBaseUMP, UMP, UMP)
(Inherited from AvaloniaObject)
SetCurrentValue(AvaloniaProperty, Object)
(Inherited from AvaloniaObject)
SetCurrentValue``1(StyledPropertyUMP, UMP)
(Inherited from AvaloniaObject)
SetValue(AvaloniaProperty, Object, BindingPriority)
(Inherited from AvaloniaObject)
SetValue``1(DirectPropertyBaseUMP, UMP)
(Inherited from AvaloniaObject)
SetValue``1(StyledPropertyUMP, UMP, BindingPriority)
(Inherited from AvaloniaObject)
ToStringReturns a string that represents the current object.
(Inherited from Object)
TryGetResource(Object, ThemeVariant, Object)
(Inherited from StyledElement)
UpdateDataValidation(AvaloniaProperty, BindingValueType, Exception) Called to update the validation state for properties for which data validation is enabled.
(Inherited from SelectingItemsControl)
UpdateIsEffectivelyEnabled
(Inherited from InputElement)
UpdateLayout
(Inherited from Layoutable)
UpdateSelection(Control, Boolean, Boolean, Boolean, Boolean, Boolean) Updates the selection for a container based on user interaction.
(Inherited from SelectingItemsControl)
UpdateSelection(Int32, Boolean, Boolean, Boolean, Boolean, Boolean) Updates the selection for an item based on user interaction.
(Inherited from SelectingItemsControl)
UpdateSelectionFromEventSource(Object, Boolean, Boolean, Boolean, Boolean, Boolean) Updates the selection based on an event that may have originated in a container that belongs to the control.
(Inherited from SelectingItemsControl)
VerifyAccess
(Inherited from AvaloniaObject)

Events

ActualThemeVariantChanged
(Inherited from StyledElement)
AttachedToLogicalTree
(Inherited from StyledElement)
AttachedToVisualTree
(Inherited from Visual)
Closed Occurs when a Menu is closed.
(Inherited from MenuBase)
Closing Occurs when the value of the IsOpen property is changing from true to false.
ContainerClearing Occurs each time a container is cleared.
(Inherited from ItemsControl)
ContainerIndexChanged Occurs for each realized container when the index for the item it represents has changed.
(Inherited from ItemsControl)
ContainerPrepared Occurs each time a container is prepared for use.
(Inherited from ItemsControl)
ContextRequested Occurs when the user has completed a context input gesture, such as a right-click.
(Inherited from Control)
DataContextChanged
(Inherited from StyledElement)
DetachedFromLogicalTree
(Inherited from StyledElement)
DetachedFromVisualTree
(Inherited from Visual)
DoubleTapped
(Inherited from InputElement)
EffectiveViewportChanged
(Inherited from Layoutable)
GotFocus
(Inherited from InputElement)
Holding
(Inherited from InputElement)
Initialized
(Inherited from StyledElement)
KeyDown
(Inherited from InputElement)
KeyUp
(Inherited from InputElement)
LayoutUpdated
(Inherited from Layoutable)
Loaded Occurs when the control has been fully constructed in the visual tree and both layout and render are complete.
(Inherited from Control)
LostFocus
(Inherited from InputElement)
Opened Occurs when a Menu is opened.
(Inherited from MenuBase)
Opening Occurs when the value of the IsOpen property is changing from false to true.
PointerCaptureLost
(Inherited from InputElement)
PointerEntered
(Inherited from InputElement)
PointerExited
(Inherited from InputElement)
PointerMoved
(Inherited from InputElement)
PointerPressed
(Inherited from InputElement)
PointerReleased
(Inherited from InputElement)
PointerWheelChanged
(Inherited from InputElement)
PreparingContainer Occurs immediately before a container is prepared for use.
(Inherited from ItemsControl)
PropertyChanged
(Inherited from AvaloniaObject)
ResourcesChanged
(Inherited from StyledElement)
SelectionChanged Occurs when the control's selection changes.
(Inherited from SelectingItemsControl)
SizeChanged Occurs when the bounds (actual size) of the control have changed.
(Inherited from Control)
Tapped
(Inherited from InputElement)
TemplateApplied Raised when the control's template is applied.
(Inherited from TemplatedControl)
TextInput
(Inherited from InputElement)
TextInputMethodClientRequested
(Inherited from InputElement)
Unloaded Occurs when the control is removed from the visual tree.
(Inherited from Control)

Fields

Extension Methods

BringIntoView Tries to bring the control into view.
(Defined by ControlExtensions)
BringIntoView(Rect) Tries to bring the control into view.
(Defined by ControlExtensions)
FindControlT(String) Finds the named control in the scope of the specified control.
(Defined by ControlExtensions)
FindDataTemplate(Object, IDataTemplate) Find a data template that matches a piece of data.
(Defined by DataTemplateExtensions)
GetControlT(String) Finds the named control in the scope of the specified control and throws if not found.
(Defined by ControlExtensions)
GetTemplateChildren
(Defined by TemplateExtensions)

See Also