In This Article

ColorInterpolationExtension Class

Provides a markup extension for finding the linear Color value that is the specified percentage between the value of two Color objects.

[TypeConverter(typeof(ColorInterpolationExtension.ColorInterpolationExtensionConverter))]
public class ColorInterpolationExtension : MarkupExtension
Inheritance:
object MarkupExtension object

Constructors

ColorInterpolationExtension()

Creates an instance of the ColorInterpolationExtension class.

public ColorInterpolationExtension()

ColorInterpolationExtension(Color, Color, double)

Creates an instance of the ColorInterpolationExtension class.

public ColorInterpolationExtension(Color color1, Color color2, double percentage)
Parameter Type Description
color1 Color

The first Color.

color2 Color

The second Color.

percentage double

The percentage from the first color towards the second.

Properties

Color1

Gets or sets the first Color.

[ConstructorArgument("color1")]
public Color Color1 { get; set; }

Property Value

Color:

The first Color.

Color2

Gets or sets the second Color.

[ConstructorArgument("color2")]
public Color Color2 { get; set; }

Property Value

Color:

The second Color.

Percentage

Gets or sets the percentage from the first color towards the second.

[ConstructorArgument("percentage")]
public double Percentage { get; set; }

Property Value

double:

The percentage from the first color towards the second.

Methods

ProvideValue(IServiceProvider)

Returns the interpolated color value.

public override object ProvideValue(IServiceProvider serviceProvider)
Parameter Type Description
serviceProvider IServiceProvider

An object 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