Silverlight treeview observablecollection not updating

Net world and you want to start building silverlight controls, databinding is one those things that works somewhat the same, yet somewhat differently from the standard Data Source, Data Bind() world that you may be used to. Net is done in a stateless way – once that binding operation is completed, it’s a done deal and if you want to change anything, now you have to manipulate the underlying controls that were created as a result of the data binding, or else change the underlying data objects and call Data Bind() again.That’s what we are used to – but it’s certainly not ideal. This is a generic list type that allows you to put any object into it.The code that is retrieving the on-demand data is in my View Model, so I don't even have a reference to my Rad Tree View control in this file to call its Update Layout() (this is the correct way to do things in MVVM).I also don't have access to any of the tree view items (only my Object Explorer Items), so I can't set the Is Expanded property.As described above, when the user elects to expand the node, the data loads on demand correctly, but the node remains unexpanded.The user must attempt to expand the node for a second time to see the child nodes that were loaded on demand. Clear() then the node expands straight away as expected.

Net, but allows us to take advantage of a stateful environment – especially for calling web service and REST APIs asynchronously. It seems to me that this collection is only avaiable in WPF and Silverlight?The One Time binding mode ignores any changes to the underlying collections so you can safely change them later without worrying about your UI going all wonky (or which thread you are operating from).Threading will become very important when you are updating in item in an Observable Collection – you need to be aware of what thread you are currently running in and possible use the Dispatcher to make that change – since the Notifier events will bubble up to the UI synchronously from the call you are in.If you choose to participate, the online survey will be presented to you when you leave the Msdn Web site. Observable Collection only provided notifications when we make any change in the collection itself like Adding or Removing an Item.

Leave a Reply