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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Treeview not updating when ObservableCollection changes

Thread ID:

Created:

Updated:

Platform:

Replies:

147179 Sep 4,2019 01:24 AM UTC Sep 4,2019 07:05 AM UTC Xamarin.Forms 2
loading
Tags: SfTreeView
Greg Harris
Asked On September 4, 2019 01:24 AM UTC

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">












Greg Harris
Replied On 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 :)

Subburaj Pandian Veluchamy [Syncfusion]
Replied On 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    


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon