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