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

Treeview not updating when ObservableCollection changes

Hi,
Maybe I am not understanding this correctly. I have a sfTreeView bound to an ObservableCollection in my ViewModel.
When I add a new item to the collection, the TreeView does not update.
I put both a ListView and the TreeView side by side and bound them both identically to the same collection. The Listview updates perfectly.
If the collection has triggered the PropertyChanged, shouldn't the tree show the new item? Why do they behave differently? Here are the two XAML blocks.
ItemsSource="{Binding TreeItems}"
SelectedItem="{Binding SelectedTreeViewItem, Mode=TwoWay}"
RowHeight="60"
SeparatorVisibility="None"
HasUnevenRows="false"
IsPullToRefreshEnabled="False"

VerticalOptions="FillAndExpand">










BackgroundColor="White"
SelectedItem="{Binding SelectedTreeViewItem, Mode=TwoWay}"
ItemsSource="{Binding TreeItems}"
ChildPropertyName="Songs"
IsAnimationEnabled="False"
AutoExpandMode="None"
ItemHeight="60"
VerticalOptions="FillAndExpand">












2 Replies

GH Greg Harris September 4, 2019 01:32 AM UTC

Of course after hours of trying to figure it out, as soon as I posted I saw that I missed the NotificaitonSubscriptionMode="CollectionChanged" option.

It's working now.

Nevermind :)


SP Subburaj Pandian Veluchamy Syncfusion Team September 4, 2019 07:05 AM UTC

Hi Greg,                     
       
Thank you for the update. We are happy that you resolved the mentioned issue at your end.

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


Loader.
Live Chat Icon For mobile
Up arrow icon