Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

RepositoryItemPopupBase.CustomizeContextItem Event

Allows you to customize the context buttons for individual items.

Namespace: DevExpress.XtraEditors.Repository

Assembly: DevExpress.XtraEditors.v24.2.dll

NuGet Package: DevExpress.Win.Navigation

#Declaration

[DXCategory("Context Buttons")]
public event ListBoxControlContextButtonCustomizeEventHandler CustomizeContextItem

#Event Data

The CustomizeContextItem event's data class is DevExpress.XtraEditors.ViewInfo.ListBoxControlContextButtonCustomizeEventArgs.

#Remarks

By default, the popup editor displays the context buttons with the same properties in all items. The CustomizeContextItem event fires for each context button in each item before the editor is displayed and allows you to customize the context buttons. Read the ListBoxControlContextButtonCustomizeEventArgs.Item property to determine the item being processed. The ListBoxControlContextButtonCustomizeEventArgs.ContextItem property returns the context button to be customized.

The code snippet below shows how to provide the custom appearance setting for a particular item of the ComboBoxEdit.

private void comboBoxEdit1_Properties_CustomizeContextItem(object sender, DevExpress.XtraEditors.ViewInfo.ListBoxControlContextButtonCustomizeEventArgs e) {
    RatingContextButton rcb = e.ContextItem as RatingContextButton;
    if(rcb != null) {
        String item = e.Item as String;
        if(item != null && item == "California") {
            rcb.AppearanceNormal.ForeColor = Color.Red;
        }
    }
}

The result is shown below.

ComboBoxEdit_CustomizeContextItem

See Also