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

DiagramControl.CustomGetEditableItemProperties Event

Allows you to modify the list of diagram item properties that can be edited by end-users in the Properties Panel.

Namespace: DevExpress.XtraDiagram

Assembly: DevExpress.XtraDiagram.v24.2.dll

NuGet Package: DevExpress.Win.Diagram

#Declaration

[DiagramCategory(DiagramCategory.DiagramItems)]
public event EventHandler<DiagramCustomGetEditableItemPropertiesEventArgs> CustomGetEditableItemProperties

#Event Data

The CustomGetEditableItemProperties event's data class is DevExpress.XtraDiagram.DiagramCustomGetEditableItemPropertiesEventArgs.

#Remarks

The event’s Properties member provides access to the collection of editable item properties.

See the example below.

private void diagramControl_CustomGetEditableItemProperties(object sender, DiagramCustomGetEditableItemPropertiesEventArgs e) {
    if (e.Item is DiagramShapeEx) {
        e.Properties.Add(TypeDescriptor.GetProperties(typeof(DiagramShapeEx))["Description"]);
    }
}

The event’s CreateProxyProperty method allows you to edit the object that is the item’s DataContext. See the example below.

 //DiagramShape shape = new DiagramShape() { DataContext = new Customer() { ID = 1, Name = "Test" } };
private void DiagramControl1_CustomGetEditableItemProperties(object sender, DiagramCustomGetEditableItemPropertiesEventArgs e) {
    if (e.Item is DiagramShape)
        e.Properties.Add(e.CreateProxyProperty("Name", item => ((Customer)item.DataContext).Name, (item, value) => ((Customer)item.DataContext).Name = value));
}
See Also