Class ContextMenuOpenedEventArgs
Provides data for the context menu opened event.
Inheritance
Namespace: Syncfusion.Maui.DataGrid
Assembly: Syncfusion.Maui.DataGrid.dll
Syntax
public class ContextMenuOpenedEventArgs : EventArgs
Remarks
This event argument is raised after a context menu has been fully displayed. It provides information about the menu display, such as the associated column.
Examples
Here is an example of how to use the ContextMenuOpenedEventArgs class in the ContextMenuOpened event.
[XAML]
<syncfusion:SfDataGrid x:Name="dataGrid"
ItemsSource="{Binding YourData}"
AutoGenerateColumns="True"
ContextMenuOpened="DataGrid_ContextMenuOpened" />
[C#]
private void DataGrid_ContextMenuOpened(object sender, ContextMenuOpenedEventArgs e)
{
// Log or inspect the opened menu items
foreach (var item in e.MenuItems)
{
Console.WriteLine($"Opened Menu Item: {item.Text}");
}
// Access the column that triggered the menu
var column = e.Column;
Console.WriteLine($"Context menu opened for column: {column.MappingName}");
}
Constructors
ContextMenuOpenedEventArgs()
Initializes a new instance of the ContextMenuOpenedEventArgs class.
Declaration
public ContextMenuOpenedEventArgs()
Properties
Column
Gets or sets the column associated with the context menu.
Declaration
public DataGridColumn Column { get; set; }
Property Value
Type | Description |
---|---|
DataGridColumn | The column for which the context menu was opened. |
Remarks
This property indicates which column triggered the context menu. It may be null if the menu was not triggered by a specific column.
MenuItems
Gets or sets the menu items that are being displayed.
Declaration
public IList<MenuItem> MenuItems { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IList<MenuItem> | The collection of menu items being displayed in the context menu. |
Remarks
This property provides access to the menu items that were actually displayed after any customizations from the ContextMenuOpening event.