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.v20.1.dll

Declaration

[DiagramCategory(DiagramCategory.DiagramItems)]
public event EventHandler<DiagramCustomGetEditableItemPropertiesEventArgs> CustomGetEditableItemProperties
<DiagramCategory(DiagramCategory.DiagramItems)>
Public Event CustomGetEditableItemProperties As EventHandler(Of DiagramCustomGetEditableItemPropertiesEventArgs)

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