How to binding IsExpanded property to custom object

Hi, I would like to bind IsExpanded property to my custom object for keeping the behaviour after observablecollection refresh.
With TreeViewAdv I would use this snippets:

    <syncfusion:TreeViewAdv.ItemContainerStyle>
       <Style TargetType="{x:Type syncfusion:TreeViewItemAdv}">
         <Setter Property="IsExpanded" Value="{Binding IsExpanded,UpdateSourceTrigger=PropertyChanged}"/>
       </Style>
    </syncfusion:TreeViewAdv.ItemContainerStyle>

But in SfTreeView ItemContainerStyle is not available.
Thanks in advance,
Daniele

11 Replies 1 reply marked as answer

MA Mohanram Anbukkarasu Syncfusion Team November 17, 2020 12:38 PM UTC

Hi Daniele, 

Thanks for contacting Syncfusion products.  

We are currently checking the feasibility to achieve this requirement in SfTreeView. We will update with further details on 19th November 2020. We appreciate your patience until then. 

Regards, 
Mohanram A. 



VS Vijayarasan Sivanandham Syncfusion Team November 19, 2020 02:17 PM UTC

Hi Daniele,

Sorry for the inconvenience caused.

We are trying to achieve your requirement ”How to binding IsExpanded property to custom object”. but we get some technical issue based on our source architecture. So, we are checking the feasibility to achieve your requirement. We will validate and update you the details on November 23, 2020.

We appreciate your patience until then.

Regards,
Vijayarasan S





VS Vijayarasan Sivanandham Syncfusion Team November 23, 2020 03:09 PM UTC

Hi Daniele,

Sorry for the inconvenience caused.

We are currently working on your requirement of “
How to binding IsExpanded property to custom object” and we need two more business days to validate this. We will update you with further details on or before November 25, 2020.

We appreciate your patience until then. 
 
Regards, 
Vijayarasan S


VS Vijayarasan Sivanandham Syncfusion Team November 25, 2020 02:48 PM UTC

Hi Daniele,

Thank you for your patience.

Based on provided information we have analyzed and checked your requirement of binding IsExpanded property to custom object in SfTreeView. Currently, SfTreeView does not contain support for achieve your requirement of “binding IsExpanded property to custom object in SfTreeView”.

Your requirement can be achieved in Unbound Mode in SfTreeView to Individually bind the IsExpanded property of TreeViewNode in SfTreeView.

Currently, we are checking the feasibility to provide feature request  for your requirement. We will validate and update you the details on November 30, 2020. 
Regards,
Vijayarasan S 



VS Vijayarasan Sivanandham Syncfusion Team November 30, 2020 03:35 PM UTC

Hi Daniele,

Sorry for the inconvenience caused.

We are currently working on your requirement of “binding IsExpanded property to custom object in SfTreeView” but we get some technical issue based on our source architecture and we need two more business days to validate this. We will update you with further details on December 02, 2020.

We appreciate your patience until then. 
 
Regards, 
Vijayarasan S 



VS Vijayarasan Sivanandham Syncfusion Team December 2, 2020 11:37 AM UTC

Hi Daniele,

Thank you for your patience.

SfTreeGrid supports to expand/collapse the nodes based on the value of a boolean mapping property in the underlying data object by using SfTreeGrid.ExpandStateMappingName property. TreeGrid expand/collapse the node when the specified property value in underlying data object gets changed. For more information, please refer the below UG link,

UG Link: https://help.syncfusion.com/wpf/treegrid/data-binding#expandcollapse-a-node-based-on-mapping-property 
Can you please check and confirm above-mentioned scenario is your expected behavior in SfTreeView control?

It will be helpful for us to check on it and provide you the solution at the earliest.

Regards,
Vijayarasan S 



OS Ondrej Svoboda January 7, 2021 12:42 PM UTC

Hi,
do you have there something similar also for IsSelected property?


MA Mohanram Anbukkarasu Syncfusion Team January 8, 2021 01:04 PM UTC

Hi Ondrej, 

Thanks for the update.  

We are currently validating this. We will update with further details on January 12, 2021. We appreciate your patience until then.  

Regards, 
Mohanam A. 



VS Vijayarasan Sivanandham Syncfusion Team January 12, 2021 05:23 PM UTC

Hi Ondrej,

Sorry for the inconvenience.   

We are still working on this. We will update with further details on January 15, 2021. We appreciate your patience and understanding.

Regards,
Vijayarasan S
 



VS Vijayarasan Sivanandham Syncfusion Team January 13, 2021 03:08 PM UTC

Hi Daniele,
Thank you for your patience.

We have checked the possibilities to achieve your requirements to bind IsExpanded and IsSelected property of the with data objects. Please find the details below.

 
 
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
<syncfusion:SfTreeView  
            x:Name="sfTreeView" 
            Margin="10" 
            BorderThickness="1" 
            AutoExpandMode="AllNodes" 
            BorderBrush="LightGray" 
            AllowDragging="True" 
            SelectionMode="Multiple" 
            CheckBoxMode ="Recursive" 
            CheckedItems="{Binding CheckedStates}" 
            ChildPropertyName="Models" 
            ExpandActionTrigger="Node" 
            ItemTemplateDataContextType="Node" 
            FocusVisualStyle="{x:Null}" 
            IsAnimationEnabled="True"                      
            ItemsSource="{Binding Items}" 
            SelectedItems="{Binding RelativeSource={x:Static RelativeSource.Self},Path=CheckedItems}"> 
<syncfusion:SfTreeView.ItemTemplate>
        <DataTemplate>
           <Grid>       
                <CheckBox x:Name="CheckBox" FocusVisualStyle="{x:Null}"  
                          Visibility="Collapsed" 
                          IsChecked="{Binding IsChecked, Mode=TwoWay}"/> 
                <TextBlock FontSize="12" VerticalAlignment="Center" Text="{Binding Content.State}" Margin="0"/> 
            </Grid>
        </DataTemplate>
    </syncfusion:SfTreeView.ItemTemplate>
</
syncfusion:SfTreeView> 

We have prepared a sample using the above given code example and it is available in the following link for your reference.  


Please let us know if you require further assistance from us. 
Regards,
Vijayarasan S 



VS Vijayarasan Sivanandham Syncfusion Team March 31, 2021 01:17 PM UTC

Hi  Daniele,

Thank you for your patience. 
We are glad to announce that our Essential Studio 2021 Volume 1 Release v19.1.0.54 is rolled out with your requested feature “Provide the support to ExpandStateMappingName property in SfTreeView” and is available for download under the following link. 
Please find the code example and sample in the below location, 
<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> 
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance. 
Regards,
Vijayarasan S  


Marked as answer
Loader.
Up arrow icon