windowsforms-devexpress-dot-xtradiagram-dot-diagramcontrol-89444214.md
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.v25.2.dll
NuGet Package : DevExpress.Win.Diagram
[DiagramCategory(DiagramCategory.DiagramItems)]
public event EventHandler<DiagramCustomGetEditableItemPropertiesEventArgs> CustomGetEditableItemProperties
<DiagramCategory(DiagramCategory.DiagramItems)>
Public Event CustomGetEditableItemProperties As EventHandler(Of DiagramCustomGetEditableItemPropertiesEventArgs)
The CustomGetEditableItemProperties event's data class is DevExpress.XtraDiagram.DiagramCustomGetEditableItemPropertiesEventArgs.
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"]);
}
}
Private Sub diagramControl_CustomGetEditableItemProperties(ByVal sender As Object, ByVal e As DiagramCustomGetEditableItemPropertiesEventArgs)
If TypeOf e.Item Is DiagramShapeEx Then
e.Properties.Add(TypeDescriptor.GetProperties(GetType(DiagramShapeEx))("Description"))
End If
End Sub
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));
}
'Dim shape As New DiagramShape() With {
' .DataContext = New Customer() With {
' .ID = 1,
' .Name = "Test"
' }
'}
Private Sub DiagramControl1_CustomGetEditableItemProperties(ByVal sender As Object, ByVal e As DiagramCustomGetEditableItemPropertiesEventArgs)
If TypeOf e.Item Is DiagramShape Then
e.Properties.Add(e.CreateProxyProperty("Name", Function(item) CType(item.DataContext, Customer).Name, Function(item, value) CType(item.DataContext, Customer).Name = value))
End If
End Sub
See Also