GradientBrush::ColorInterpolationMode Property
.NET Framework (current version)
Gets or sets a ColorInterpolationMode enumeration that specifies how the gradient's colors are interpolated.
Assembly: PresentationCore (in PresentationCore.dll)
public: property ColorInterpolationMode ColorInterpolationMode { ColorInterpolationMode get(); void set(ColorInterpolationMode value); }
Property Value
Type: System.Windows.Media::ColorInterpolationModeSpecifies how the colors in a gradient are interpolated. The default is ColorInterpolationMode::SRgbLinearInterpolation.
The following example shows two similar gradients that have different modes of color interpolation, which causes the interpolation to happen in different color spaces.
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <StackPanel> <Rectangle Width="200" Height="100" Margin="10"> <Rectangle.Fill> <!-- This gradient uses a ColorInterpolationMode of "ScRgbLinearInterpolation" which indicates that the colors of the gradient are interpolated using the ScRGB color space. --> <LinearGradientBrush ColorInterpolationMode="ScRgbLinearInterpolation" StartPoint="0,0.5" EndPoint="1,0.5"> <LinearGradientBrush.GradientStops> <GradientStop Color="Blue" Offset="0.0" /> <GradientStop Color="Red" Offset="0.25" /> <GradientStop Color="Blue" Offset="0.75" /> <GradientStop Color="LimeGreen" Offset="1" /> </LinearGradientBrush.GradientStops> </LinearGradientBrush> </Rectangle.Fill> </Rectangle> <Rectangle Width="200" Height="100" Margin="10"> <Rectangle.Fill> <!-- This gradient uses a ColorInterpolationMode of "SRgbLinearInterpolation" which indicates that the colors of the gradient are interpolated using the sRGB color space. --> <LinearGradientBrush ColorInterpolationMode="SRgbLinearInterpolation" StartPoint="0,0.5" EndPoint="1,0.5"> <LinearGradientBrush.GradientStops> <GradientStop Color="Blue" Offset="0.0" /> <GradientStop Color="Red" Offset="0.25" /> <GradientStop Color="Blue" Offset="0.75" /> <GradientStop Color="LimeGreen" Offset="1" /> </LinearGradientBrush.GradientStops> </LinearGradientBrush> </Rectangle.Fill> </Rectangle> </StackPanel> </Page>
The following illustration shows what the preceding example produces.

.NET Framework
Available since 3.0
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Available since 3.0
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Show: