DxContextMenu.ClickExpression Property

OBSOLETE

This property is obsolete now. Use the ItemClick property instead.

Specifies a lambda expression that returns a handler for a menu item’s Click event.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v21.1.dll

Declaration

[Browsable(false)]
[Obsolete("This property is obsolete now. Use the ItemClick property instead.")]
[Parameter]
public Expression<Func<object, Action>> ClickExpression { get; set; }

Property Value

Type Description
Expression<Func<Object, Action>>

A lambda expression that returns a handler for a menu item’s Click event.

Remarks

When the Context Menu component is bound to a data source, use the ClickExpression property to specify the lambda expression that returns a handler for a menu item’s Click event. This property allows you to specify different handlers for different menu items.

<DxContextMenu Data="@MenuItems"
               ClickExpression="(item => (item as TextFormattingMenuItem).Click)">
</DxContextMenu>

@code {
    List<TextFormattingMenuItem> menuItems;

    abstract class TextFormattingMenuItem {
        protected TextFormattingMenuItem(TextFormatting textFormatting, string text) {
            TextFormatting = textFormatting;
            Text = text;
        }

        public TextFormatting TextFormatting { get; }
        public string Text { get; }
        public virtual void Click() { }
    }
}

ContextMenu Item Children

Run Demo: Context Menu - Data Binding

For unbound context menus, use the Click to handle an individual item’s click.

You can also specify a common click handler that is applied to all menu items along with individual handlers (specified by the ClickExpression property or the Click event’s handler). To specify a common handler, use the ItemClick event.

See Also