I have an application where the underlying data for my xamDataTree is contained in an instance of a custom class similar to your DataUtil example, except I'm using instance members instead of static members to initialize the data. This allows me to build the data dynamically while the application is initializing. As part of the app initialization, I build up the data in memory, then set the xamDataTree.ItemsSource property to bind the data to the xamDataTree control. All this is working fine. Later (after initial app init), the app becomes aware of new tree data (provided externally), at which point the app updates the xamDataTree's underlying data object. In order to get the new data to be updated in the xamDataTree control, my code sets the xamDataTree.ItemsSource property over again to re-bind the data. Is this the preferred method of dynamically updating the data binding for the xamDataTree control or is there a better method (like using WPF triggers or events)?
Hello,
Thank you for your reply. I am very glad that my sample application was helpful for you. Please let me know if you need any further assistance on the matter.
Please let me know if you need any further assistance on the matter.
Sincerely,
Krasimir
Developer Support Engineer
Infragistics
www.infragistics.com/support
Thank you very much! This solved my problem. It always helps to have some simple sample code to help understand how to do it, so thanks for that as well!
Thank you for your post. I have been looking into your question and for updating the XamDataTree, I can suggest using collections that implements INotifyCollectionChanged interface, which allows the XamDataTree to notify that there are items added or removed from the ItemsSource. This allows updating the XamDataTree without re-setting the ItemsSource property. Also you can implement INotifyPropertyChanged interface for the data objects in the source of the XamDataTree, in order to update the XamDataTree when the properties of the nodes are updated. I have created a sample application for you, that demonstrates how you can implement the approach I have described.