Back to Devexpress

DiagramControl.CustomGetSerializableItemProperties Event

windowsforms-devexpress-dot-xtradiagram-dot-diagramcontrol-ab817538.md

latest3.6 KB
Original Source

DiagramControl.CustomGetSerializableItemProperties Event

Allows you to modify the list of serializable properties of diagram items.

Namespace : DevExpress.XtraDiagram

Assembly : DevExpress.XtraDiagram.v25.2.dll

NuGet Package : DevExpress.Win.Diagram

Declaration

csharp
[DiagramCategory(DiagramCategory.DiagramItems)]
public event EventHandler<DiagramCustomGetSerializableItemPropertiesEventArgs> CustomGetSerializableItemProperties
vb
<DiagramCategory(DiagramCategory.DiagramItems)>
Public Event CustomGetSerializableItemProperties As EventHandler(Of DiagramCustomGetSerializableItemPropertiesEventArgs)

Event Data

The CustomGetSerializableItemProperties event's data class is DiagramCustomGetSerializableItemPropertiesEventArgs. The following properties provide information specific to this event:

PropertyDescription
ItemTypeReturns the serialized item type.
PropertiesReturns the collection of serializable properties.
SerializationKindIndicates the context of serialization.

The event data class exposes the following methods:

MethodDescription
CreateProxyProperty(PropertyDescriptor, Func<IDiagramItem, Object>, IEnumerable<Attribute>)Allows you to create a custom property descriptor.
CreateProxyProperty<TProperty>(String, Func<IDiagramItem, TProperty>, Action<IDiagramItem, TProperty>, IEnumerable<Attribute>)Allows you to create a custom property descriptor.

Remarks

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

The example below illustrates how to exclude the Content property from serialization.

csharp
private void diagramControl1_CustomGetSerializableItemProperties(object sender, DevExpress.XtraDiagram.DiagramCustomGetSerializableItemPropertiesEventArgs e) {
    if (e.ItemType == typeof(DiagramShape))
        e.Properties.Remove(e.Properties["Content"]);
}
vb
Private Sub diagramControl1_CustomGetSerializableItemProperties(ByVal sender As Object, ByVal e As DevExpress.XtraDiagram.DiagramCustomGetSerializableItemPropertiesEventArgs)
    If e.ItemType Is GetType(DiagramShape) Then
        e.Properties.Remove(e.Properties("Content"))
    End If
End Sub

See Also

DiagramControl Class

DiagramControl Members

DevExpress.XtraDiagram Namespace