Skip to main content

PopupMenuShowingEventArgs Class

Provides data for the TreeList.PopupMenuShowing event.

Namespace: DevExpress.XtraTreeList

Assembly: DevExpress.XtraTreeList.v23.2.dll

NuGet Packages: DevExpress.Win.Navigation, DevExpress.Win.TreeList

Declaration

public class PopupMenuShowingEventArgs :
    EventArgs

Remarks

The PopupMenuShowingEventArgs objects are automatically created, initialized and passed to the TreeList.PopupMenuShowing event handlers.

Example

The following sample code handles the TreeList.PopupMenuShowing event for the following two purposes.

  • Disables the summary footer context menu for the “Department” column.
  • Removes the “Runtime columns customization” item of the column header context menu.
using DevExpress.XtraTreeList;

private void treeList1_PopupMenuShowing(object sender, PopupMenuShowingEventArgs e) {
    TreeList treeList = sender as TreeList;
    TreeListHitInfo hitInfo = treeList.CalcHitInfo(e.Point);

    // prohibiting summary footer menu for the "Department" column
    if (hitInfo.HitInfoType == HitInfoType.SummaryFooter &&
      hitInfo.Column.Caption == "Department")
        e.Allow = false;

    // removing the "Runtime columns customization" item of the column header menu
    if (hitInfo.HitInfoType == HitInfoType.Column) {
        string caption = TreeListLocalizer.Active.GetLocalizedString(GetMenuColumnCustomizationStringId(treeList));
        e.Menu.Items.Remove(e.Menu.Items.FirstOrDefault(x => x.Caption == caption));
    }
}

private TreeListStringId GetMenuColumnCustomizationStringId(TreeList treeList) {
    if (treeList.OptionsView.ShowBandsMode == DefaultBoolean.True || (treeList.OptionsView.ShowBandsMode == DefaultBoolean.Default && treeList.Bands.Count > 0))
        return TreeListStringId.MenuColumnBandCustomization;
    return TreeListStringId.MenuColumnColumnCustomization;
}

Inheritance

Object
EventArgs
PopupMenuShowingEventArgs
See Also