Class ContextMenuClosingEventArgs
Provides data for the context menu closing event.
Inheritance
System.Object
ContextMenuClosingEventArgs
Namespace: Syncfusion.Maui.DataGrid
Assembly: Syncfusion.Maui.DataGrid.dll
Syntax
public class ContextMenuClosingEventArgs : EventArgs
Remarks
This event argument is raised before a context menu is dismissed. It allows you to cancel the closing or perform operations before the menu disappears.
Examples
Here is an example of how to use the ContextMenuClosingEventArgs class in the ContextMenuClosing event.
[XAML]
<syncfusion:SfDataGrid x:Name="dataGrid"
ItemsSource="{Binding YourData}"
AutoGenerateColumns="True"
ContextMenuClosing="DataGrid_ContextMenuClosing"/>
[C#]
private void DataGrid_ContextMenuClosing(object sender, ContextMenuClosingEventArgs e)
{
// Optionally cancel the closing
if (e.MenuItems.Any(item => item.Text == "Delete"))
{
e.Cancel = true;
}
// Access the column that triggered the menu
var column = e.Column;
}
Constructors
ContextMenuClosingEventArgs()
Initializes a new instance of the ContextMenuClosingEventArgs class.
Declaration
public ContextMenuClosingEventArgs()
Properties
Cancel
Gets or sets a value indicating whether the context menu should be canceled and remain open.
Declaration
public bool Cancel { get; set; }
Property Value
Type |
---|
System.Boolean |
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 is being closed. |
MenuItems
Gets or sets the menu items that were displayed before closing.
Declaration
public IList<MenuItem> MenuItems { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IList<MenuItem> | The collection of menu items shown in the context menu. |