DxContextMenu.BeginGroupExpression Property
OBSOLETE
This property is obsolete now. Add the DataMappings tag to markup, define a collection of DxContextMenuDataMapping items, and map item properties to data source fields instead.
Specifies a lambda expression that returns a Boolean value. This value indicates whether an item is the start of a new item group.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v22.2.dll
NuGet Package: DevExpress.Blazor
Declaration
[Browsable(false)]
[Obsolete("This property is obsolete now. Add the DataMappings tag to markup, define a collection of DxContextMenuDataMapping items, and map item properties to data source fields instead.")]
[Parameter]
public Expression<Func<object, bool>> BeginGroupExpression { get; set; }
Property Value
Type | Description |
---|---|
Expression<Func<Object, Boolean>> | A lambda expression that returns a Boolean value: |
Remarks
You can split context menu items into groups. A horizontal line separates groups.
When the Context Menu component is bound to a data source, use the BeginGroupExpression
property to specify a lambda expression that returns a Boolean value (true
if the item is the start of a new item group).
<DxContextMenu Data="@MenuItems"
BeginGroupExpression="(item => (item as TextFormattingMenuItem).BeginGroup)">
</DxContextMenu>
@code {
List<TextFormattingMenuItem> menuItems;
TextFormatting Formatting { get; set; } = new TextFormatting();
public class TextFormatting {
public string FontFamily { get; set; }
public int FontSize { get; set; }
public Dictionary<string, bool> Decoration { get; } = new Dictionary<string, bool>() {
{ "Bold", false },
...
{ "Overline" , false }
};
}
abstract class TextFormattingMenuItem {
protected TextFormattingMenuItem(TextFormatting textFormatting, string text) {
TextFormatting = textFormatting;
Text = text;
}
public TextFormatting TextFormatting { get; }
public string Text { get; }
public bool BeginGroup { get; set; }
}
List<TextFormattingMenuItem> MenuItems {
get {
if (menuItems == null) {
menuItems = new List<TextFormattingMenuItem>() {
new TextFormattingParentMenuItem(Formatting, "Font", new List<TextFormattingMenuItem>() {
new FontFamilyMenuItem(Formatting, "Times New Roman", "Times New Roman"),
...
new FontFamilyMenuItem(Formatting, "Default", null) { BeginGroup = true }
}),
new TextFormattingParentMenuItem(Formatting, "Style", new List<TextFormattingMenuItem>() {
new TextDecorationMenuItem(Formatting, "Bold", "Bold"),
...
new TextDecorationMenuItem(Formatting, "Strikethrough", "Strikethrough")
}),
new ClearFormattingMenuItem(Formatting) { BeginGroup = true }
};
}
return menuItems;
}
}
}
For unbound context menus, use the BeginGroup property to specify the start of a new item group.