We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Subscribing to AfterItemEdit if tree items are dynamic

Hello,

How would I go about subscribing to the AfterItemEdit event for each item in the TreeViewAdv if I am using data binding and the tree view items are dynamic?

Thanks,

Hayley


3 Replies

DB Dinesh Babu Yadav Syncfusion Team August 15, 2019 08:44 AM UTC

Hi Havley 
 
Thank you for contacting Syncfusion Support 
 
Query :How would I go about subscribing to the AfterItemEdit event for each item in the TreeViewAdv if I am using data binding and the tree view items are dynamic? 
 
We have checked your query and observed that you need to access the AfterItemEdit event for TreeViewItemAdv using databinding. We have prepared the simple sample for the same and subscribed the AfterItemEdit event of TreeViewItem using ItemContainerStyle property of TreeViewAdv.  It would invoke for all the items and dynamic added treeviewitems. Please find the sample and code from below: 
 
Code[XAML] 
 
<syncfusion:TreeViewAdv x:Name="TreeViewone"  ItemsSource="{Binding TreeItems}" SelectedTreeItem="{Binding SelectedTreeItem, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Grid.Row="0"> 
 
<syncfusion:TreeViewAdv.ItemContainerStyle> 
<Style TargetType="{x:Type syncfusion:TreeViewItemAdv}"> 
<EventSetter Event="AfterItemEdit" Handler="TreeViewItemAdv_AfterItemEdit"/> 
</Style> 
</syncfusion:TreeViewAdv.ItemContainerStyle> 
<syncfusion:TreeViewAdv.ItemTemplate> 
 
<HierarchicalDataTemplate ItemsSource="{Binding SubItems}"> 
 
<TextBlock Text="{Binding Header}" /> 
 
</HierarchicalDataTemplate> 
 
</syncfusion:TreeViewAdv.ItemTemplate> 
 
</syncfusion:TreeViewAdv> 
 
 
 
 
Please try this solution and let us know if it is helpful. 
 
Regards 
Dinesh Babu Yadav 



HM Hayley Miller August 16, 2019 01:09 AM UTC

Thanks! This works great :)



SP Subburaj Pandian Veluchamy Syncfusion Team August 19, 2019 08:41 AM UTC

Hi Hayley, 
 
Thank you for the update. We are glad that the given solution meets your requirement. 

Please get in touch with us, if you would require any further assistance in future.  
 
Regards,
Subburaj Pandian V  


Loader.
Live Chat Icon For mobile
Up arrow icon