What are Shapes in MAUI and how do they differ from GraphicsView drawing?
Short answer
Shapes (Rectangle, Ellipse, Line, Path, Polygon, Polyline) are declarative XAML elements in the visual tree with Fill, Stroke, and geometry properties, so they participate in layout and can be styled/animated individually.
Advertisement
AModel answer
Shapes (Rectangle, Ellipse, Line, Path, Polygon, Polyline) are declarative XAML elements in the visual tree with Fill, Stroke, and geometry properties, so they participate in layout and can be styled/animated individually. GraphicsView is imperative immediate-mode drawing—faster for many primitives but not part of the visual tree.
<Path Stroke="Black" Fill="LightBlue"
Data="M0,0 L100,0 100,100 Z" />
<Ellipse WidthRequest="60" HeightRequest="60" Fill="Coral" />Real-world example
A simple decorative divider uses a Path shape in XAML, while a data-dense chart uses GraphicsView for performance.
Likely follow-ups
- When are Shapes better than GraphicsView? | Can Shapes be animated?
Related topics