They are later updated by the call to On Parent Surface Rendered.
Later when another annotation is added using the Add button On Labels Source Changed is not called, the chart can be updated however by double clicking which causes On Parent Surface Rendered to be called.
Many Thanks Dai Hello Dai, I was able to make this work with a small modification to your example code.
You have a nicely structured MVVM application there by the way 🙂So – you created a class called Annotation Creation Modifier, which was binding to Observable Collection in your view-model.
Also I would advise against re-buiding annotations on each re-draw.
This can cause performance problems, since adding an annotation could in fact trigger a redraw!
The problem is that none of the buttons seems to work. The first step is to get the UI to respond to changes in the list source (Items Source), like when we add or delete a user.
What we need is a list that notifies any destinations of changes to its content, and fortunately, WPF provides a type of list that will do just that.
Observable Collection is one of the most useful classes in WPF and Silverlight data binding.So far in this tutorial, we have mostly created bindings between UI elements and existing classes, but in real life applications, you will obviously be binding to your own data objects.This is just as easy, but once you start doing it, you might discover something that disappoints you: Changes are not automatically reflected, like they were in previous examples.The example is pretty simple, with a User class that will keep the name of the user, a List Box to show them in and some buttons to manipulate both the list and its contents.The Items Source of the list is assigned to a quick list of a couple of users that we create in the window constructor.