It works the first time the drawModel gets initialized but not if I update the Data property later on.
You should make Data
an ObservableCollection<PointF>
(or, even better, ObservableCollection<System.Windows.Point>
, as WPF's Point already supports floating point values).
The issue is that adding to, removing from, or changing a List<T>
doesn't provide any form of notication to WPF that things have changed. ObservableCollection<T>
implements INotifyCollectionChanged
, which is the collection version of INotifyPropertyChagned
.
Note that this will still not trigger an update within your control. If you require that, you could subscribe to the Draw.Data
's CollectionChanged
event to be notified of changes wtihin the collection.