Share via


Brush Class

Definition

Defines the core behavior and built-in colors for painting an area.

public ref class Brush abstract : Microsoft::Maui::Controls::Element
[System.ComponentModel.TypeConverter(typeof(Microsoft.Maui.Controls.BrushTypeConverter))]
public abstract class Brush : Microsoft.Maui.Controls.Element
[<System.ComponentModel.TypeConverter(typeof(Microsoft.Maui.Controls.BrushTypeConverter))>]
type Brush = class
    inherit Element
Public MustInherit Class Brush
Inherits Element
Inheritance
Derived
Attributes

Remarks

Derived classes describe different ways of painting an area.

Constructors

Brush()

Fields

transientNamescope (Inherited from Element)

Properties

AliceBlue

Gets a SolidColorBrush of the system-defined color AliceBlue.

AntiqueWhite

Gets a SolidColorBrush of the system-defined color AntiqueWhite.

Aqua

Gets a SolidColorBrush of the system-defined color Aqua.

Aquamarine

Gets a SolidColorBrush of the system-defined color Aquamarine.

AutomationId

Gets or sets a value that allows the automation framework to find and interact with this element.

(Inherited from Element)
Azure

Gets a SolidColorBrush of the system-defined color Azure.

Beige

Gets a SolidColorBrush of the system-defined color Beige.

BindingContext

Gets or sets an object that contains the properties that will be targeted by the bound properties that belong to this BindableObject. This is a bindable property.

(Inherited from BindableObject)
Bisque

Gets a SolidColorBrush of the system-defined color Bisque.

Black

Gets a SolidColorBrush of the system-defined color Black.

BlanchedAlmond

Gets a SolidColorBrush of the system-defined color BlanchedAlmond.

Blue

Gets a SolidColorBrush of the system-defined color Blue.

BlueViolet

Gets a SolidColorBrush of the system-defined color BlueViolet.

Brown

Gets a SolidColorBrush of the system-defined color Brown.

BurlyWood

Gets a SolidColorBrush of the system-defined color BurlyWood.

CadetBlue

Gets a SolidColorBrush of the system-defined color CadetBlue.

Chartreuse

Gets a SolidColorBrush of the system-defined color Chartreuse.

Chocolate

Gets a SolidColorBrush of the system-defined color Chocolate.

ClassId

Gets or sets a value used to identify a collection of semantically similar elements.

(Inherited from Element)
Coral

Gets a SolidColorBrush of the system-defined color Coral.

CornflowerBlue

Gets a SolidColorBrush of the system-defined color CornflowerBlue.

Cornsilk

Gets a SolidColorBrush of the system-defined color Cornsilk.

Crimson

Gets a SolidColorBrush of the system-defined color Crimson.

Cyan

Gets a SolidColorBrush of the system-defined color Cyan.

DarkBlue

Gets a SolidColorBrush of the system-defined color DarkBlue.

DarkCyan

Gets a SolidColorBrush of the system-defined color DarkCyan.

DarkGoldenrod

Gets a SolidColorBrush of the system-defined color DarkGoldenrod.

DarkGray

Gets a SolidColorBrush of the system-defined color DarkGray.

DarkGreen

Gets a SolidColorBrush of the system-defined color DarkGreen.

DarkGrey

Gets a SolidColorBrush of the system-defined color DarkGrey.

DarkKhaki

Gets a SolidColorBrush of the system-defined color DarkKhaki.

DarkMagenta

Gets a SolidColorBrush of the system-defined color DarkMagenta.

DarkOliveGreen

Gets a SolidColorBrush of the system-defined color DarkOliveGreen.

DarkOrange

Gets a SolidColorBrush of the system-defined color DarkOrange.

DarkOrchid

Gets a SolidColorBrush of the system-defined color DarkOrchid.

DarkRed

Gets a SolidColorBrush of the system-defined color DarkRed.

DarkSalmon

Gets a SolidColorBrush of the system-defined color DarkSalmon.

DarkSeaGreen

Gets a SolidColorBrush of the system-defined color DarkSeaGreen.

DarkSlateBlue

Gets a SolidColorBrush of the system-defined color DarkSlateBlue.

DarkSlateGray

Gets a SolidColorBrush of the system-defined color DarkSlateGray.

DarkSlateGrey

Gets a SolidColorBrush of the system-defined color DarkSlateGrey.

DarkTurquoise

Gets a SolidColorBrush of the system-defined color DarkTurquoise.

DarkViolet

Gets a SolidColorBrush of the system-defined color DarkViolet.

DeepPink

Gets a SolidColorBrush of the system-defined color DeepPink.

DeepSkyBlue

Gets a SolidColorBrush of the system-defined color DeepSkyBlue.

Default

Represents the default (empty) brush.

DimGray

Gets a SolidColorBrush of the system-defined color DimGray.

DimGrey

Gets a SolidColorBrush of the system-defined color DimGrey.

Dispatcher

Gets the dispatcher that was available when this bindable object was created, otherwise tries to find the nearest available dispatcher (probably the window's/app's).

(Inherited from BindableObject)
DodgerBlue

Gets a SolidColorBrush of the system-defined color DodgerBlue.

EffectControlProvider

For internal use by .NET MAUI.

(Inherited from Element)
Effects

Gets or sets the styles and properties that will be applied to the element during runtime.

(Inherited from Element)
Firebrick

Gets a SolidColorBrush of the system-defined color Firebrick.

FloralWhite

Gets a SolidColorBrush of the system-defined color FloralWhite.

ForestGreen

Gets a SolidColorBrush of the system-defined color ForestGreen.

Fuchsia

Gets a SolidColorBrush of the system-defined color Fuchsia.

Gainsboro

Gets a SolidColorBrush of the system-defined color Gainsboro.

GhostWhite

Gets a SolidColorBrush of the system-defined color GhostWhite.

Gold

Gets a SolidColorBrush of the system-defined color Gold.

Goldenrod

Gets a SolidColorBrush of the system-defined color Goldenrod.

Gray

Gets a SolidColorBrush of the system-defined color Gray.

Green

Gets a SolidColorBrush of the system-defined color Green.

GreenYellow

Gets a SolidColorBrush of the system-defined color GreenYellow.

Grey

Gets a SolidColorBrush of the system-defined color Grey.

Handler

Gets or sets the associated handler for this element.

(Inherited from Element)
Honeydew

Gets a SolidColorBrush of the system-defined color Honeydew.

HotPink

Gets a SolidColorBrush of the system-defined color HotPink.

Id

Gets a value that can be used to uniquely identify an element throughout the run of your application.

(Inherited from Element)
IndianRed

Gets a SolidColorBrush of the system-defined color IndianRed.

Indigo

Gets a SolidColorBrush of the system-defined color Indigo.

IsEmpty

When overridden in a derived class, indicates whether the given brush represents the empty brush.

Ivory

Gets a SolidColorBrush of the system-defined color Ivory.

Khaki

Gets a SolidColorBrush of the system-defined color Khaki.

Lavender

Gets a SolidColorBrush of the system-defined color Lavender.

LavenderBlush

Gets a SolidColorBrush of the system-defined color LavenderBlush.

LawnGreen

Gets a SolidColorBrush of the system-defined color LawnGreen.

LemonChiffon

Gets a SolidColorBrush of the system-defined color LemonChiffon.

LightBlue

Gets a SolidColorBrush of the system-defined color LightBlue.

LightCoral

Gets a SolidColorBrush of the system-defined color LightCoral.

LightCyan

Gets a SolidColorBrush of the system-defined color LightCyan.

LightGoldenrodYellow

Gets a SolidColorBrush of the system-defined color LightGoldenrodYellow.

LightGray

Gets a SolidColorBrush of the system-defined color LightGray.

LightGreen

Gets a SolidColorBrush of the system-defined color LightGreen.

LightGrey

Gets a SolidColorBrush of the system-defined color LightGrey.

LightPink

Gets a SolidColorBrush of the system-defined color LightPink.

LightSalmon

Gets a SolidColorBrush of the system-defined color LightSalmon.

LightSeaGreen

Gets a SolidColorBrush of the system-defined color LightSeaGreen.

LightSkyBlue

Gets a SolidColorBrush of the system-defined color LightSkyBlue.

LightSlateGray

Gets a SolidColorBrush of the system-defined color LightSlateGray.

LightSlateGrey

Gets a SolidColorBrush of the system-defined color LightSlateGrey.

LightSteelBlue

Gets a SolidColorBrush of the system-defined color LightSteelBlue.

LightYellow

Gets a SolidColorBrush of the system-defined color LightYellow.

Lime

Gets a SolidColorBrush of the system-defined color Lime.

LimeGreen

Gets a SolidColorBrush of the system-defined color LimeGreen.

Linen

Gets a SolidColorBrush of the system-defined color Linen.

LogicalChildren
Obsolete.
(Inherited from Element)
Magenta

Gets a SolidColorBrush of the system-defined color Magenta.

Maroon

Gets a SolidColorBrush of the system-defined color Maroon.

MediumAquamarine

Gets a SolidColorBrush of the system-defined color MediumAquamarine.

MediumBlue

Gets a SolidColorBrush of the system-defined color MediumBlue.

MediumOrchid

Gets a SolidColorBrush of the system-defined color MediumOrchid.

MediumPurple

Gets a SolidColorBrush of the system-defined color MediumPurple.

MediumSeaGreen

Gets a SolidColorBrush of the system-defined color MediumSeaGreen.

MediumSlateBlue

Gets a SolidColorBrush of the system-defined color MediumSlateBlue.

MediumSpringGreen

Gets a SolidColorBrush of the system-defined color MediumSpringGreen.

MediumTurquoise

Gets a SolidColorBrush of the system-defined color MediumTurquoise.

MediumVioletRed

Gets a SolidColorBrush of the system-defined color MediumVioletRed.

MidnightBlue

Gets a SolidColorBrush of the system-defined color MidnightBlue.

MintCream

Gets a SolidColorBrush of the system-defined color MintCream.

MistyRose

Gets a SolidColorBrush of the system-defined color MistyRose.

Moccasin

Gets a SolidColorBrush of the system-defined color Moccasin.

NavajoWhite

Gets a SolidColorBrush of the system-defined color NavajoWhite.

Navy

Gets a SolidColorBrush of the system-defined color Navy.

OldLace

Gets a SolidColorBrush of the system-defined color OldLace.

Olive

Gets a SolidColorBrush of the system-defined color Olive.

OliveDrab

Gets a SolidColorBrush of the system-defined color OliveDrab.

Orange

Gets a SolidColorBrush of the system-defined color Orange.

OrangeRed

Gets a SolidColorBrush of the system-defined color OrangeRed.

Orchid

Gets a SolidColorBrush of the system-defined color Orchid.

PaleGoldenrod

Gets a SolidColorBrush of the system-defined color PaleGoldenrod.

PaleGreen

Gets a SolidColorBrush of the system-defined color PaleGreen.

PaleTurquoise

Gets a SolidColorBrush of the system-defined color PaleTurquoise.

PaleVioletRed

Gets a SolidColorBrush of the system-defined color PaleVioletRed.

PapayaWhip

Gets a SolidColorBrush of the system-defined color PapayaWhip.

Parent

Gets or sets the parent Element of this element.

(Inherited from Element)
PeachPuff

Gets a SolidColorBrush of the system-defined color PeachPuff.

Peru

Gets a SolidColorBrush of the system-defined color Peru.

Pink

Gets a SolidColorBrush of the system-defined color Pink.

Plum

Gets a SolidColorBrush of the system-defined color Plum.

PowderBlue

Gets a SolidColorBrush of the system-defined color PowderBlue.

Purple

Gets a SolidColorBrush of the system-defined color Purple.

RealParent

For internal use by .NET MAUI.

(Inherited from Element)
Red

Gets a SolidColorBrush of the system-defined color Red.

RosyBrown

Gets a SolidColorBrush of the system-defined color RosyBrown.

RoyalBlue

Gets a SolidColorBrush of the system-defined color RoyalBlue.

SaddleBrown

Gets a SolidColorBrush of the system-defined color SaddleBrown.

Salmon

Gets a SolidColorBrush of the system-defined color Salmon.

SandyBrown

Gets a SolidColorBrush of the system-defined color SandyBrown.

SeaGreen

Gets a SolidColorBrush of the system-defined color SeaGreen.

SeaShell

Gets a SolidColorBrush of the system-defined color SeaShell.

Sienna

Gets a SolidColorBrush of the system-defined color Sienna.

Silver

Gets a SolidColorBrush of the system-defined color Silver.

SkyBlue

Gets a SolidColorBrush of the system-defined color SkyBlue.

SlateBlue

Gets a SolidColorBrush of the system-defined color SlateBlue.

SlateGray

Gets a SolidColorBrush of the system-defined color SlateGray.

SlateGrey

Gets a SolidColorBrush of the system-defined color SlateGrey.

Snow

Gets a SolidColorBrush of the system-defined color Snow.

SpringGreen

Gets a SolidColorBrush of the system-defined color SpringGreen.

SteelBlue

Gets a SolidColorBrush of the system-defined color SteelBlue.

StyleId

Gets or sets a user defined value to uniquely identify the element.

(Inherited from Element)
Tan

Gets a SolidColorBrush of the system-defined color Tan.

Teal

Gets a SolidColorBrush of the system-defined color Teal.

Thistle

Gets a SolidColorBrush of the system-defined color Thistle.

Tomato

Gets a SolidColorBrush of the system-defined color Tomato.

Transparent

Gets a SolidColorBrush of the system-defined color Transparent.

Turquoise

Gets a SolidColorBrush of the system-defined color Turquoise.

Violet

Gets a SolidColorBrush of the system-defined color Violet.

Wheat

Gets a SolidColorBrush of the system-defined color Wheat.

White

Gets a SolidColorBrush of the system-defined color White.

WhiteSmoke

Gets a SolidColorBrush of the system-defined color WhiteSmoke.

Yellow

Gets a SolidColorBrush of the system-defined color Yellow.

YellowGreen

Gets a SolidColorBrush of the system-defined color YellowGreen.

Methods

AddLogicalChild(Element)

Adds an Element to the logical children.

(Inherited from Element)
ApplyBindings()

Applies all the current bindings to BindingContext.

(Inherited from BindableObject)
ClearLogicalChildren()

Removes all child Elements.

(Inherited from Element)
ClearValue(BindableProperty)

Clears any value that is previously set for a bindable property.

(Inherited from BindableObject)
ClearValue(BindablePropertyKey)

Clears any value that is previously set for a bindable property, identified by its key.

(Inherited from BindableObject)
CoerceValue(BindableProperty)

Coerces the value of the specified bindable property. This is done by invoking BindableProperty.CoerceValueDelegate of the specified bindable property.

(Inherited from BindableObject)
CoerceValue(BindablePropertyKey)

Coerces the value of the specified bindable property. This is done by invoking BindableProperty.CoerceValueDelegate of the specified bindable property.

(Inherited from BindableObject)
EffectIsAttached(String)

For internal use by .NET MAUI.

(Inherited from Element)
FindByName(String)

Returns the element that has the specified name.

(Inherited from Element)
GetValue(BindableProperty)

Returns the value that is contained in the given bindable property.

(Inherited from BindableObject)
InsertLogicalChild(Int32, Element)

Inserts an Element to the logical children at the specified index.

(Inherited from Element)
IsNullOrEmpty(Brush)

Indicates whether the specified Brush is null or empty.

IsSet(BindableProperty)

Determines whether or not a bindable property exists and has a value set.

(Inherited from BindableObject)
OnBindingContextChanged()

Invoked whenever the binding context of the element changes. Implement this method to add class handling for this event.

(Inherited from Element)
OnChildAdded(Element)

Raises the ChildAdded event. Implement this method to add class handling for this event.

(Inherited from Element)
OnChildRemoved(Element, Int32)

Raises the ChildRemoved event. Implement this method to add class handling for this event

(Inherited from Element)
OnHandlerChanged()

When overridden in a derived class, should raise the HandlerChanged event.

(Inherited from Element)
OnHandlerChanging(HandlerChangingEventArgs)

When overridden in a derived class, should raise the HandlerChanging event.

(Inherited from Element)
OnParentChanged()

When overridden in a derived class, should raise the ParentChanged event.

(Inherited from Element)
OnParentChanging(ParentChangingEventArgs)

When overridden in a derived class, should raise the ParentChanging event.

(Inherited from Element)
OnParentSet()

Raises the (internal) ParentSet event. Implement this method in order to add behavior when the element is added to a parent.

(Inherited from Element)
OnPropertyChanged(String)

Method that is called when a bound property is changed.

(Inherited from Element)
OnPropertyChanging(String)

Raises the PropertyChanging event.

(Inherited from BindableObject)
RemoveBinding(BindableProperty)

Removes a previously set binding from a bindable property.

(Inherited from BindableObject)
RemoveDynamicResource(BindableProperty)

Removes a previously set dynamic resource.

(Inherited from Element)
RemoveLogicalChild(Element)

Removes the first occurrence of a specific Element from the logical children.

(Inherited from Element)
SetBinding(BindableProperty, BindingBase)

Assigns a binding to a bindable property.

(Inherited from BindableObject)
SetDynamicResource(BindableProperty, String)

Sets the BindableProperty property of this element to be updated via the DynamicResource with the provided key.

(Inherited from Element)
SetValue(BindableProperty, Object)

Sets the value of the specified bindable property.

(Inherited from BindableObject)
SetValue(BindablePropertyKey, Object)

Sets the value of the specified bindable property.

(Inherited from BindableObject)
SetValueFromRenderer(BindableProperty, Object)

For internal use by .NET MAUI.

(Inherited from Element)
SetValueFromRenderer(BindablePropertyKey, Object)

For internal use by .NET MAUI.

(Inherited from Element)
UnapplyBindings()

Removes all current bindings from the current context.

(Inherited from BindableObject)

Operators

Implicit(Brush to Paint)
Implicit(Color to Brush)
Implicit(Paint to Brush)

Events

BindingContextChanged

Occurs when the value of the BindingContext property changes.

(Inherited from BindableObject)
ChildAdded

Raised whenever a child element is added to the element.

(Inherited from Element)
ChildRemoved

Raised whenever a child element is removed from the element.

(Inherited from Element)
DescendantAdded

Raised whenever a child element is added to the element's subtree.

(Inherited from Element)
DescendantRemoved

Raised whenever a child element is removed from the elements subtree.

(Inherited from Element)
HandlerChanged

Raised whenever the element's handler has changed.

(Inherited from Element)
HandlerChanging

Raised whenever the element's handler starts to change.

(Inherited from Element)
ParentChanged

Raised whenever the element's parent has changed.

(Inherited from Element)
ParentChanging

Raised whenever the element's starts to change.

(Inherited from Element)
PropertyChanged

Occurs when a property value changes.

(Inherited from BindableObject)
PropertyChanging

Occurs when a property value is changing.

(Inherited from BindableObject)

Explicit Interface Implementations

IContextFlyoutElement.ContextFlyout

Gets the ContextFlyout for the view. Menu flyouts, menu flyout subitems, and menu flyout separators can be added to the context flyout.

(Inherited from Element)
IDynamicResourceHandler.SetDynamicResource(BindableProperty, String) (Inherited from BindableObject)
IEffectControlProvider.RegisterEffect(Effect)

Registers the specified effect to this element.

(Inherited from Element)
IElement.Parent

Gets the Parent of the Element.

(Inherited from Element)
IElementController.Descendants()

For internal use by .NET MAUI.

(Inherited from Element)
IElementController.LogicalChildren

For internal use by .NET MAUI.

(Inherited from Element)
IElementController.SetValueFromRenderer(BindableProperty, Object)

For internal use by .NET MAUI.

(Inherited from Element)
INameScope.RegisterName(String, Object)

For internal use by .NET MAUI.

(Inherited from Element)
INameScope.UnregisterName(String)

For internal use by .NET MAUI.

(Inherited from Element)
IToolTipElement.ToolTip

Represents a small rectangular pop-up window that displays a brief description of a view's purpose when the user rests the pointer on the view.

(Inherited from Element)
IVisualTreeElement.GetVisualChildren()

Gets a readonly list of the element's visual children.

(Inherited from Element)
IVisualTreeElement.GetVisualParent()

Gets the element's visual parent.

(Inherited from Element)

Extension Methods

GetPropertyIfSet<T>(BindableObject, BindableProperty, T)
SetAppTheme<T>(BindableObject, BindableProperty, T, T)
SetAppThemeColor(BindableObject, BindableProperty, Color, Color)
SetBinding(BindableObject, BindableProperty, String, BindingMode, IValueConverter, String)

Creates and applies a binding to a property.

SetBinding<TSource,TProperty>(BindableObject, BindableProperty, Func<TSource,TProperty>, BindingMode, IValueConverter, Object, String, Object, Object, Object)

Creates a binding between a property on the source object and a property on the target object.

FindByName<T>(Element, String)
ToHandler(IElement, IMauiContext)
ToPlatform(IElement, IMauiContext)
GetVisualElementWindow(IVisualTreeElement)

Gets the Window containing the Visual Tree Element, if the element is contained within one.

GetVisualTreeDescendants(IVisualTreeElement)

Gets the entire hierarchy of descendants as a list of children for a given Visual Tree Element.

GetVisualTreeElements(IVisualTreeElement, Point)

Gets list of a Visual Tree Element's children based off of a given Point.

GetVisualTreeElements(IVisualTreeElement, Rect)

Gets list of a Visual Tree Elements children based off of a rectangle.

GetVisualTreeElements(IVisualTreeElement, Double, Double, Double, Double)

Gets list of a Visual Tree Elements children based off of a rectangle defined by its coordinates which are specified in platform units, not pixels.

GetVisualTreeElements(IVisualTreeElement, Double, Double)

Gets list of a Visual Tree Elements children based off of a given x, y point.

Applies to