Skip to main content

TreeListView.ExpandStateBinding Property

Gets or sets the binding that determines which nodes are expanded.

Namespace: DevExpress.Xpf.Grid

Assembly: DevExpress.Xpf.Grid.v24.2.dll

NuGet Package: DevExpress.Wpf.Grid.Core

Declaration

public Binding ExpandStateBinding { get; set; }

Property Value

Type Description
Binding

A Binding object specifying which nodes are expanded.

Remarks

Tree List - ExpandStateBinding Example

<Window.Resources>
    <local:ExpandedConverter x:Key="expandedConverter"/>
</Window.Resources>
<dxg:TreeListControl ItemsSource="{Binding Employees}" 
                     AutoGenerateColumns="AddNew" 
                     EnableSmartColumnsGeneration="True">
    <dxg:TreeListControl.View>
        <dxg:TreeListView KeyFieldName="ID" 
                          ParentFieldName="ParentID" 
                          ExpandStateBinding="{Binding Position, Converter={StaticResource expandedConverter}}"/>
    </dxg:TreeListControl.View>
</dxg:TreeListControl>
public class ExpandedConverter : IValueConverter {
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
        if (value.ToString() == "President")
            return true;
        return false;
    }

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
        throw new NotImplementedException();
    }
}
See Also