PropertyGridControl.RowBrickMenuShowing Event
Allows you to populate a context menu invoked with a click on a brick button (the Office view only).
Namespace: DevExpress.XtraVerticalGrid
Assembly: DevExpress.XtraVerticalGrid.v24.2.dll
Declaration
Event Data
The RowBrickMenuShowing event's data class is PopupMenuShowingEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
Allow | Gets or sets whether to display the context menu. Inherited from BasePopupMenuShowingEventArgs. |
HitInfoType | Identifies a grid element located under the popup menu. |
InRecordHeader | Gets whether the menu is displayed within a record header. |
InRow | Gets whether the menu is displayed within a row. |
Menu | Gets or sets the control’s popup menu that will be shown. |
Point | Gets or sets coordinates of the invoked context menu (top-left corner) relative to the parent control. Inherited from BasePopupMenuShowingEventArgs. |
RecordIndex | Gets the index of a record where the popup menu will be displayed. |
RecordObject | Gets a data object that corresponds to a row where the popup menu will be displayed. |
Row | Gets the row where the popup menu will be displayed. |
ScreenPoint | Gets coordinates of the invoked context menu (top-left corner) relative to the screen. Inherited from BasePopupMenuShowingEventArgs. |
The event data class exposes the following methods:
Method | Description |
---|---|
ShowCustomMenu(IDXDropDownControlEx) | Invokes a custom context menu instead of the control’s menu. Inherited from BasePopupMenuShowingEventArgs. |
ShowCustomMenu(ContextMenuStrip) | Invokes a custom context menu instead of the control’s menu. Inherited from BasePopupMenuShowingEventArgs. |
Remarks
In the Office view (see PropertyGridControl.ActiveViewType), you can display brick buttons against properties by setting the PropertyGridControl.OptionsView.ShowRowBrick property to True (see PGridOptionsView.ShowRowBrick).
The RowBrickMenuShowing event allows you to populate the menu.
using DevExpress.Utils.Menu;
propertyGridControl1.RowBrickMenuShowing += propertyGridControl1_RowBrickMenuShowing;
private void propertyGridControl1_RowBrickMenuShowing(object sender, DevExpress.XtraVerticalGrid.Events.PopupMenuShowingEventArgs e) {
if (e.Row.Properties.FieldName == "Appearance.BackColor")
e.Menu.Items.Add(CreateDataBindingItem);
}
DXMenuItem createDataBindingItem;
protected DXMenuItem CreateDataBindingItem {
get {
if (createDataBindingItem == null) {
DXMenuItem item = new DXMenuItem("Create Data Binding...");
item.Click += (s, ee) => MessageBox.Show("'Create Data Binding...' is clicked.");
createDataBindingItem = item;
}
return createDataBindingItem;
}
}
Note
Items added using this event are not shown when the menu is invoked with a right-click on a property (see PGridOptionsView.ShowRowBrick).
You can also customize the brick buttons by handling the PropertyGridControl.CustomDrawRowBrick event.