Skip to main content

BoxShadow Struct

Definition​

Namespace:Avalonia.Media
Assembly:Avalonia.Base
Package:Avalonia

Represents a box shadow which can be attached to an element or control.

public struct BoxShadow

Inheritance: ValueType -> BoxShadow

Methods​

NameDescription
Equals (2 overloads)No summary available.
GetHashCodeNo summary available.
ParseParses a Avalonia.Media.BoxShadow string.
ToStringNo summary available.
TransformBoundsNo summary available.

Equals overloads​

Equals Method​

public bool Equals(Avalonia.Media.BoxShadow& other)
Parameters​

other Avalonia.Media.BoxShadow&

Returns​

bool

Equals Method​

public bool Equals(object obj)
Parameters​

obj object

Returns​

bool

GetHashCode Method​

public int GetHashCode()

Returns​

int

Parse Method​

Parses a Avalonia.Media.BoxShadow string.

public Avalonia.Media.BoxShadow Parse(string s)

Parameters​

s string

The input string to parse.

Returns​

Avalonia.Media.BoxShadow

A new Avalonia.Media.BoxShadow

Remarks​

A box shadow may be specified in multiple formats with separate components:

  • Two, three, or four length values.
  • A color value.
  • An optional inset keyword.

If only two length values are given they will be interpreted as Avalonia.Media.BoxShadow.OffsetX and Avalonia.Media.BoxShadow.OffsetY. If a third value is given, it is interpreted as a Avalonia.Media.BoxShadow.Blur, and if a fourth value is given, it is interpreted as Avalonia.Media.BoxShadow.Spread.

ToString Method​

public string ToString()

Returns​

string

TransformBounds Method​

public Avalonia.Rect TransformBounds(Avalonia.Rect& rect)

Parameters​

rect Avalonia.Rect&

Returns​

Avalonia.Rect

Properties​

NameDescription
BlurGets or sets the blur radius. This is used to control the amount of blurring.
ColorGets or sets the color of the shadow.
IsInsetGets or sets a value indicating whether the shadow is inset and drawn within the element rather than outside of it.
OffsetXGets or sets the horizontal offset (distance) of the shadow.
OffsetYGets or sets the vertical offset (distance) of the shadow.
SpreadGets or sets the spread radius. This is used to control the overall size of the shadow.

Blur Property​

Gets or sets the blur radius. This is used to control the amount of blurring.

public double Blur { get; set; }

Remarks​

The larger this value, the bigger the blur effect, so the shadow becomes larger and more transparent. Negative values are not allowed. If not specified, the default (zero) is used and the shadow edge is sharp.

Color Property​

Gets or sets the color of the shadow.

public Avalonia.Media.Color Color { get; set; }

IsInset Property​

Gets or sets a value indicating whether the shadow is inset and drawn within the element rather than outside of it.

public bool IsInset { get; set; }

Remarks​

Inset changes the shadow to inside the element (as if the content was depressed inside the box). If false (the default), the shadow is assumed to be a drop shadow (as if the box were raised above the content).

Inset shadows are drawn inside the element, above the background (even when it's transparent), but below any content.

OffsetX Property​

Gets or sets the horizontal offset (distance) of the shadow.

public double OffsetX { get; set; }

Remarks​

Positive values place the shadow to the right of the element while negative values place the shadow to the left.

OffsetY Property​

Gets or sets the vertical offset (distance) of the shadow.

public double OffsetY { get; set; }

Remarks​

Positive values place the shadow below the element while negative values place the shadow above.

Spread Property​

Gets or sets the spread radius. This is used to control the overall size of the shadow.

public double Spread { get; set; }

Remarks​

Positive values will cause the shadow to expand and grow larger, negative values will cause the shadow to shrink. If not specified, the default (zero) is used and the shadow will be the same size as the element.