Back to Devexpress

TreeList.PropertySerializing Event

windowsforms-devexpress-dot-xtratreelist-dot-treelist-ab8fe842.md

latest3.3 KB
Original Source

TreeList.PropertySerializing Event

Allows you to include certain settings in the layout when you save it.

Namespace : DevExpress.XtraTreeList

Assembly : DevExpress.XtraTreeList.v25.2.dll

NuGet Packages : DevExpress.Win.Navigation, DevExpress.Win.TreeList

Declaration

csharp
[DXCategory("Events")]
public event EventHandler<PropertyAllowEventArgs> PropertySerializing
vb
<DXCategory("Events")>
Public Event PropertySerializing As EventHandler(Of PropertyAllowEventArgs)

Event Data

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

PropertyDescription
AllowGets or sets whether to allow property serialization or deserialization.
OptionsLayoutGets layout settings of the control whose layout is being serialized or deserialized.
OwnerGets the control or UI element whose layout settings are being serialized or deserialized.
PropertyNameGets the property name currently being processed.

Remarks

Handle the PropertySerializing and PropertyDeserializing events for fine-grained control over layout saving/restoring. The e.PropertyName parameter specifies which property/setting is currently being processed. Use the e.Allow property to allow or disallow property serialization.

You can also use the OptionsLayout property to specify layout-related settings.

Read the following topic for information and examples: Save and Restore Layouts of DevExpress Controls.

Example

The following example demonstrates how to avoid serializing certain settings:

csharp
treeList.PropertySerializing += (s, e) => {
    if(e.Owner is TreeListColumn && e.PropertyName == "Caption")
        e.Allow = DefaultBoolean.False;
};
vb
AddHandler treeList.PropertySerializing, Sub(s, e)
    If TypeOf e.Owner Is TreeListColumn AndAlso e.PropertyName = "Caption" Then
        e.Allow = DefaultBoolean.False
    End If
End Sub

See Also

PropertyDeserializing

TreeList Class

TreeList Members

DevExpress.XtraTreeList Namespace