Advertisement
Intermediate .NET MAUI, Graphics & Drawing

How do you trigger a redraw of a GraphicsView?

Short answer

Call Invalidate() on the GraphicsView to request that Draw runs again. Do this whenever the data your drawable depends on changes. For animation, invalidate on a timer or from an animation callback, keeping the Draw method fast to sustain frame rate.

Save .NET MAUI mock interview
Advertisement
AModel answer
Call Invalidate() on the GraphicsView to request that Draw runs again. Do this whenever the data your drawable depends on changes. For animation, invalidate on a timer or from an animation callback, keeping the Draw method fast to sustain frame rate.
graphicsView.Drawable = _drawable;
_drawable.Progress = 0.75f;
graphicsView.Invalidate();   // schedules a repaint
Real-world example
A progress gauge repaints smoothly by updating its value and calling Invalidate as a download advances.
Likely follow-ups
  • Why keep Draw fast? | How do you animate a GraphicsView?
Related topics