Paints an area with a linear gradient.
Inheritance
- Object
- DependencyObject
- Brush
- GradientBrush
- LinearGradientBrush
Syntax
<LinearGradientBrush ...> oneOrMoreGradientStops </LinearGradientBrush
XAML Values
- oneOrMoreGradientStops
-
One or more GradientStop object elements. Object elements defined here become members of the collection when code accesses the GradientStops property at run time.
Attributes
- ActivatableAttribute(NTDDI_WIN8)
- ActivatableAttribute(Windows.UI.Xaml.Media.ILinearGradientBrushFactory, NTDDI_WIN8)
- MarshalingBehaviorAttribute(Agile)
- StaticAttribute(Windows.UI.Xaml.Media.ILinearGradientBrushStatics, NTDDI_WIN8)
- ThreadingAttribute(Both)
- VersionAttribute(NTDDI_WIN8)
- WebHostHiddenAttribute()
Members
The LinearGradientBrush class has these types of members:
Constructors
The LinearGradientBrush class has these constructors.
| Constructor | Description |
|---|---|
| LinearGradientBrush() | Initializes a new instance of the LinearGradientBrush class. |
| LinearGradientBrush(GradientStopCollection, Double) | Initializes a new instance of the LinearGradientBrush class that has the specified GradientStopCollection and angle. |
Methods
The LinearGradientBrush class has these methods. It also inherits methods from the Object class.
| Method | Description |
|---|---|
| ClearValue | Clears the local value of a dependency property. (Inherited from DependencyObject) |
| GetAnimationBaseValue | Returns any base value established for a dependency property, which would apply in cases where an animation is not active. (Inherited from DependencyObject) |
| GetValue | Returns the current effective value of a dependency property from a DependencyObject. (Inherited from DependencyObject) |
| ReadLocalValue | Returns the local value of a dependency property, if a local value is set. (Inherited from DependencyObject) |
| SetValue | Sets the local value of a dependency property on a DependencyObject. (Inherited from DependencyObject) |
Properties
The LinearGradientBrush class has these properties.
| Property | Access type | Description |
|---|---|---|
| Read/write | Gets or sets a ColorInterpolationMode enumeration value that specifies how the gradient's colors are interpolated. (Inherited from GradientBrush) | |
| Read-only | Gets the CoreDispatcher that this object is associated with. (Inherited from DependencyObject) | |
| Read/write | Gets or sets the ending two-dimensional coordinates of the linear gradient. | |
| Read-only | Identifies the EndPoint dependency property. | |
| Read/write | Gets or sets the brush's gradient stops. (Inherited from GradientBrush) | |
| Read/write | Gets or sets a BrushMappingMode enumeration value that specifies whether the positioning coordinates of the gradient brush are absolute or relative to the output area. (Inherited from GradientBrush) | |
| Read/write | Gets or sets the degree of opacity of a Brush. (Inherited from Brush) | |
| Read/write | Gets or sets the transformation that is applied to the brush using relative coordinates. (Inherited from Brush) | |
| Read/write | Gets or sets the type of spread method that specifies how to draw a gradient that starts or ends inside the bounds of the object to be painted. (Inherited from GradientBrush) | |
| Read/write | Gets or sets the starting two-dimensional coordinates of the linear gradient. | |
| Read-only | Identifies the StartPoint dependency property. | |
| Read/write | Gets or sets the transformation that is applied to the brush. (Inherited from Brush) |
Examples
This example creates a linear gradient with four colors and uses it to paint a Rectangle.
<StackPanel> <!-- This rectangle is painted with a vertical linear gradient. --> <Rectangle Width="200" Height="100"> <Rectangle.Fill> <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> <GradientStop Color="Yellow" Offset="0.0" /> <GradientStop Color="Red" Offset="0.25" /> <GradientStop Color="Blue" Offset="0.75" /> <GradientStop Color="LimeGreen" Offset="1.0" /> </LinearGradientBrush> </Rectangle.Fill> </Rectangle> </StackPanel>
This illustration shows the resulting gradient. The gradient axis is marked with a dashed line and the gradient stops are marked with circles.
Requirements
|
Minimum supported client | Windows 8 [Windows Store apps only] |
|---|---|
|
Minimum supported server | Windows Server 2012 [Windows Store apps only] |
|
Namespace |
|
|
Metadata |
|
See also
Build date: 12/4/2012