LinearGradientBrushExtension Class
Implements a markup extension that returns a LinearGradientBrush based on specified parameters.
public class LinearGradientBrushExtension : MarkupExtension
- Inheritance:
- object MarkupExtension object
Remarks
This class is a markup extension implementation. Markup extension classes exist mainly to provide infrastructure support
for some aspect of the WPF XAML processor implementation, but the CreateBrush methods make be utilized from
user code to quickly generate brushes.
Constructors
LinearGradientBrushExtension()
Initializes an instance of the class.
public LinearGradientBrushExtension()
LinearGradientBrushExtension(Color, Color)
Initializes an instance of the class using the specified colors.
public LinearGradientBrushExtension(Color startColor, Color endColor)
| Parameter | Type | Description |
|---|---|---|
| startColor | Color | The start color. |
| endColor | Color | The end color. |
Properties
AdditionalStopCount
The additional stops used when creating a LinearGradientBrush.
Angle
The angle used when creating a LinearGradientBrush. This value is only used when the GradientType is set to CustomAngle.
EndColor
The end color of the gradient.
GradientType
The type of gradient.
StartColor
The start color of the gradient.
Methods
CreateBrush(Color, Color, LinearGradientType)
Creates a LinearGradientBrush based on the specified parameters.
public static LinearGradientBrush CreateBrush(Color startColor, Color endColor, LinearGradientType gradientType)
| Parameter | Type | Description |
|---|---|---|
| startColor | Color | The start color of the gradient. |
| endColor | Color | The end color of the gradient. |
| gradientType | LinearGradientType | Type of the gradient that should be created. |
Returns
CreateBrush(Color, Color, LinearGradientType, int)
Creates a LinearGradientBrush based on the specified parameters.
public static LinearGradientBrush CreateBrush(Color startColor, Color endColor, LinearGradientType gradientType, int additionalStopCount)
| Parameter | Type | Description |
|---|---|---|
| startColor | Color | The start color of the gradient. |
| endColor | Color | The end color of the gradient. |
| gradientType | LinearGradientType | Type of the gradient that should be created. |
| additionalStopCount | int | The number of additional stops that should be included. |
Returns
CreateBrush(Color, Color, double)
Creates a LinearGradientBrush based on the specified parameters.
public static LinearGradientBrush CreateBrush(Color startColor, Color endColor, double angle)
| Parameter | Type | Description |
|---|---|---|
| startColor | Color | The start color of the gradient. |
| endColor | Color | The end color of the gradient. |
| angle | double | The angle used when creating the brush. |
Returns
CreateBrush(Color, Color, double, int)
Creates a LinearGradientBrush based on the specified parameters.
public static LinearGradientBrush CreateBrush(Color startColor, Color endColor, double angle, int additionalStopCount)
| Parameter | Type | Description |
|---|---|---|
| startColor | Color | The start color of the gradient. |
| endColor | Color | The end color of the gradient. |
| angle | double | The angle used when creating the brush. |
| additionalStopCount | int | The number of additional stops that should be included. |
Returns
ProvideValue(IServiceProvider)
When implemented in a derived class, returns an object that is provided as the value of the target property for this markup extension.
public override object ProvideValue(IServiceProvider serviceProvider)
| Parameter | Type | Description |
|---|---|---|
| serviceProvider | IServiceProvider | A service provider helper that can provide services for the markup extension. |
Returns
- object:
The object value to set on the property where the extension is applied.
Inherited Members
- object.GetType()
- object.MemberwiseClone()
- object.ToString()
- object.Equals(object)
- object.Equals(object, object)
- object.ReferenceEquals(object, object)
- object.GetHashCode()