Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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