For efficiency reasons I need to load some sub-nodes at BeforeExpand event but simply adding this new sub-data to the BindingList seems to don't work visually on the UltraTree(18.x), because the BindingList keeps the added data to the appropriate node but UltraTree seems can't add the new Nodes in question. After DoubleClick for expanding the Node, data is added, and I do even an ExpandAll and Refresh(on UltraTree) at the end but nothing seems to work to render the added data to the DataSource and I'm lost.The ViewStyle of the UltraTree is setup on Standard, is there any chance that a custom setting on the UltraTree is preventing the update of the new added sub-nodes?Here's the structure of the data itself, if it can help:
Public Class UserTable Public Property Database As String Public Property Schemas As List(Of Schema) = New List(Of Schema) End Class Public Class Schema Public Property SchemaName As String Public Property Tables As List(Of Table) = New List(Of Table) End Class Public Class Table Public Property ShortName As String Public Property Name As String Public Property Enabled As Boolean = False Public Property Columns As List(Of Column) = New List(Of Column) End Class Public Class Column Public Property Name As String Public Property Description As String End Class
And the BindingList is like:
Private Property TablesTree as New BindingList(Of UserTable)
TablesUltraTree.DataSource = TablesTree
And the nodes that I'm adding are for "Columns" with a function GetColumns() that returns a List(Of Column)Ps: If I load all the nodes(included the ones that I need to add later) at "Load" event of the form, everything shows as expected
Your welcome :)
Yes, this is it! Hell, I was strugling all day long to make it work. Lesson learned Thank you very much @Michael
Hello Eugenio,
Thank you for contacting Infragistics. I see you are using a List of <T> and not an actual BindingList which responds to notifications to properly update the UI. Modifying a List<T> doesn't provide update notifications. Change the List(Of Column) to a BindingList and hook the tree's PropertyChanged event as a way to confirm it's actually updating in the UI.
this.ultraTree1.PropertyChanged += new Infragistics.Win.PropertyChangedEventHandler(this.ultraTree1_PropertyChanged);
void ultraTree1_PropertyChanged(object sender, Infragistics.Win.PropertyChangedEventArgs e){ PropChangeInfo pci = e.ChangeInfo; PropChangeInfo rootTrigger = pci.FindTrigger( null ); if ( rootTrigger != null && rootTrigger.Source is TreeNodesCollection ) { }}
Let me know if you have any questions.