<syncfusion:TreeViewAdv.ItemContainerStyle> <Style TargetType="{x:Type syncfusion:TreeViewItemAdv}"> <Setter Property="IsExpanded" Value="{Binding IsExpanded,UpdateSourceTrigger=PropertyChanged}"/> </Style> </syncfusion:TreeViewAdv.ItemContainerStyle>|
Binding IsExpanded property |
We have considered this requirement and planned to provide the ”Support for ExpandStateMappingName property in SfTreeView” and logged feature request for the same. We will implement this feature in our Essential Studio 2021 Volume 1 release which is estimated to be rolled out in March 2021. We will let you know when this feature is implemented. We appreciate your patience until then. Feedback link: https://www.syncfusion.com/feedback/20826/provide-the-support-to-expandstatemappingname-property-in-sftreeview If you have any more specification/suggestions to the feature request, you can add it as a comment in the portal and cast your vote to make it count. | |
|
Binding IsSelected property |
You can achieve this requirement to select nodes based on the value of a bool property in the data object by using the SelectedItems and CheckedItems properties as shown in the following code example.
Code example:
We have prepared a sample using the above given code example and it is available in the following link for your reference. Sample link: https://www.syncfusion.com/downloads/support/forum/159761/ze/TreeNode_Bound_IsSelected-390556749
|
|
<syncfusion:SfTreeView x:Name="treeView"
ItemsSource="{Binding ImageNodeInfo}"
ItemTemplateDataContextType="Node">
<syncfusion:SfTreeView.HierarchyPropertyDescriptors>
<treeViewEngine:HierarchyPropertyDescriptor ChildPropertyName="SubFiles"
TargetType="local:FileManager"
IsExpandedPropertyName="IsExpanded"/>
</syncfusion:SfTreeView.HierarchyPropertyDescriptors>
<syncfusion:SfTreeView.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition />
</Grid.ColumnDefinitions>
<CheckBox IsChecked="{Binding Content.IsExpanded}" VerticalAlignment="Center" Margin="3"/>
<TextBlock Text="{Binding Content.ItemName}" VerticalAlignment="Center" Grid.Column="1"/>
</Grid>
</DataTemplate>
</syncfusion:SfTreeView.ItemTemplate>
</syncfusion:SfTreeView> |