A brush enables you to paint an area, such as the background of a control, using different approaches. Brush support in Xamarin.Forms is available in the
Xamarin.Forms namespace on iOS, Android, macOS, the Universal Windows Platform (UWP), and the Windows Presentation Foundation (WPF).
Brush support in Xamarin.Forms is currently experimental and can only be used by setting the
Brush_Experimental flag. For more information, see Experimental Flags.
Brush class is an abstract class that paints an area with its output. Classes that derive from
Brush describe different ways of painting an area. The following list describes the different brush types available in Xamarin.Forms:
SolidColorBrush, which paints an area with a solid color. For more information, see Xamarin.Forms Brushes: Solid colors.
LinearGradientBrush, which paints an area with a linear gradient. For more information, see Xamarin.Forms Brushes: Linear gradients.
RadialGradientBrush, which paints an area with a radial gradient. For more information, see Xamarin.Forms Brushes: Radial gradients.
Instances of these brush types can be assigned to the
Fill properties of a
Shape, and the
Background property of a
VisualElement.Background property enables brushes to be used as the background in any control.
Brush class also has an
IsNullOrEmpty method that returns a
bool that represents whether the brush is defined or not.