I have a simple WPF Window with a Canvas on it and the Canvas has a Path object with a GeometryGroup inside the Path:
<Path
Stroke="Red"
StrokeThickness="3">
<Path.Data>
<GeometryGroup Children="{Binding Elements}" />
</Path.Data>
</Path>
So I initialize the Elements collection before the InitializeComponent() call and it shows up correctly. After that using a System.Timers.Timer I update the existing shape’s points so they move. This works. But the problem is I only see the Canvas updating its result when the WPF Window is moved by a mouse. If I leave it there, then the last image just hangs there but the points are updated.
I can see this when I start moving the WPF Window again and the Shapes jump to their latest location.
Any ideas on how to fix this and why it’s doing it?
You need to implement INotifyPropertyChanged on the class you’re binding to, and the list of items should implement INotifyCollectionChanged, like ObservableCollection. Once you do that, timers or dispatchers are not needed.