wpf-devexpress-dot-xpf-dot-grid-dot-treelistview-a1ca0cad.md
Gets or sets the binding that determines which nodes are expanded.
Namespace : DevExpress.Xpf.Grid
Assembly : DevExpress.Xpf.Grid.v25.2.dll
NuGet Package : DevExpress.Wpf.Grid.Core
public Binding ExpandStateBinding { get; set; }
Public Property ExpandStateBinding As Binding
| Type | Description |
|---|---|
| Binding |
A Binding object specifying which nodes are expanded.
|
<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();
}
}
Public Class ExpandedConverter
Inherits IValueConverter
Public Function Convert(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object
If value.ToString() = "President" Then Return True
Return False
End Function
Public Function ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object
Throw New NotImplementedException()
End Function
End Class
See Also