Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
90
XamTreeNode dynamic update of ExpandedIconTemplate
posted

<ig:XamDataTree x:Name="_xamDataTree" Background="Transparent" ItemsSource="{Binding Items}" ActiveNodeChanging="ActiveNodeChanging" ActiveNodeChanged="_xamDataTree_ActiveNodeChanged"
infPrism:XamDataTreeItemSelected.Command="{x:Static inf:Commands.NavigateCommand}" >


<ig:ContextMenuService.Manager >

<ig:ContextMenuManager>
<ig:ContextMenuManager.ContextMenu>
<ig:XamContextMenu x:Name="contextMenu" Opening="contextMenu_Opening">
</ig:XamContextMenu>
</ig:ContextMenuManager.ContextMenu>
</ig:ContextMenuManager>
</ig:ContextMenuService.Manager>


<ig:XamDataTree.GlobalNodeLayouts>
<ig:NodeLayout Key="ItemsLayout" TargetTypeName="NavigationItem" DisplayMemberPath="Caption" IsExpandedMemberPath="IsExpanded">


<ig:NodeLayout.ExpandedIconTemplate>
<DataTemplate>
<Image Source="{Binding Path = Data.ExpandedImagePath}" />
</DataTemplate>
</ig:NodeLayout.ExpandedIconTemplate>
<ig:NodeLayout.CollapsedIconTemplate>
<DataTemplate>
<Image Source="{Binding Path=Data.CollapsedImagePath }" />
</DataTemplate>
</ig:NodeLayout.CollapsedIconTemplate>

</ig:NodeLayout>
</ig:XamDataTree.GlobalNodeLayouts>
</ig:XamDataTree>

Hello, 

Using the above piece of code, when binding to a collection of NavigationItems, I am able to see the expanded & collapsed icons in the tree.

At runtime, when I click on a node, I would like to change the expanded and collapsed icons. Changing the ExpandedImagePath on the Data associated with a XamTreeNode is not updating the UI of the treenode with the new image. 

Appreciate your help on this very much. 

Thanks

Parents
No Data
Reply
  • 34430
    Verified Answer
    Offline posted

    Hello Amal,

    Thank you for your post.

    I have been investigating into your requirement, and I was initially able to reproduce the issue you were seeing. However, after implementing the INotifyPropertyChanged interface on my data items and using it with the paths used for the collapsed image and the expanded image, I was able to see the image change in the UI. Are you implementing this interface on your end?

    I have attached a sample project that uses much of the relevant code that you have provided along with the ActiveNodeChanged event of the XamDataTree to change the node icon paths. I hope it helps you.

    Please let me know if you have any other questions or concerns on this matter.

    Sincerely,
    Andrew
    Associate Developer
    Infragistics Inc.
    www.infragistics.com/support

    XamDataTreeDynamicIconsCase.zip
Children
No Data