Center Property (RadialGradientBrush)
Gets or sets the center of the outermost circle of the radial gradient.
XAML |
<object Center="Point" .../>
|
Scripting |
value = object.Center object.Center = value |
Property Value
The two-dimensional point located at the center of the radial gradient.
This property is read/write. The default value is a point with value 0.5,0.5.
Remarks
The default central point location of the gradient circle is (0.5, 0.5).
See remarks in Point for scripting usages of this property.
Specifying Relative or Absolute Values
The MappingMode property of a RadialGradientBrush determines whether its coordinate properties are interpreted as a relative or absolute value. By default, Center is treated as relative, which corresponds to a MappingMode of RelativeToBoundingBox. A MappingMode of Absolute specifies that the Center value is expressed in device independent pixels, not as a factor within the bounding box of the area where the brush is applied.
Examples
The following XAML example shows some RadialGradientBrush attribute usages.
XAML |
---|
<Canvas xmlns="https://schemas.microsoft.com/client/2007" xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml"> <!-- This rectangle is painted with a radial gradient. --> <Rectangle Width="200" Height="100"> <Rectangle.Fill> <RadialGradientBrush GradientOrigin="0.5,0.5" Center="0.5,0.5" RadiusX="0.5" RadiusY="0.5"> <GradientStop Color="Yellow" Offset="0" /> <GradientStop Color="Red" Offset="0.25" /> <GradientStop Color="Blue" Offset="0.75" /> <GradientStop Color="LimeGreen" Offset="1" /> </RadialGradientBrush> </Rectangle.Fill> </Rectangle> </Canvas> |