menu

MAUI

  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class ContextMenuOpeningEventArgs - MAUI API Reference | Syncfusion

    Show / Hide Table of Contents

    Class ContextMenuOpeningEventArgs

    Provides data for the context menu opening event.

    Inheritance
    System.Object
    ContextMenuOpeningEventArgs
    Namespace: Syncfusion.Maui.DataGrid
    Assembly: Syncfusion.Maui.DataGrid.dll
    Syntax
    public class ContextMenuOpeningEventArgs : EventArgs
    Examples

    Here is an example of how to use the ContextMenuOpeningEventArgs class in the ContextMenuOpening event.

    [XAML]

    <syncfusion:SfDataGrid x:Name="dataGrid"
                            ItemsSource="{Binding YourData}"
                            AutoGenerateColumns="True"
                            ContextMenuOpening="DataGrid_ContextMenuOpening" />

    [C#]

    private void DataGrid_ContextMenuOpening(object sender, ContextMenuOpeningEventArgs e)
    {
        // Add a custom menu item
        e.MenuItems.Add(new MenuItem { Text = "Refresh", Command = ViewModel.RefreshCommand });
    
        // Cancel the menu if needed
        if (e.Column.MappingName == "Status")
        {
            e.Cancel = true;
        }
    }

    Constructors

    ContextMenuOpeningEventArgs()

    Initializes a new instance of the ContextMenuOpeningEventArgs class.

    Declaration
    public ContextMenuOpeningEventArgs()

    Properties

    Cancel

    Gets or sets a value indicating whether the context menu should be canceled and not displayed.

    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
    DataGridColumn

    MenuItems

    Gets or sets the collection of menu items to display in the context menu.

    Declaration
    public IList<MenuItem> MenuItems { get; set; }
    Property Value
    Type
    System.Collections.Generic.IList<MenuItem>
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved