plextekbltr

SimpleFillSymbol with LinearGradientBrush

Discussion created by plextekbltr on Nov 12, 2013
For our application we're using a LinearGradientBrush for the Fill property of a SimpleFillSymbol, with different A values in the colour at various points of the gradient, giving us different amounts of transparency at different places in the brush.
This works fine when UseAcceleratedDisplay is set false, but when UseAcceleratedDisplay is true, the alpha channel of the colours is ignored, and the brush is solid.

Is there a way to get the accelerated graphics to honour the alpha channel of different points in the brush, or am I stuck with non-accelerated graphics unless I can find another way of achieving the same effect?

Code extract:

System.Windows.Media.LinearGradientBrush br = new System.Windows.Media.LinearGradientBrush();
SimpleFillSymbol symbol = new SimpleFillSymbol();
symbol.BorderBrush = null;
symbol.BorderThickness = 1;
System.Windows.Media.Color pointColour = underlayColour.Color;
System.Windows.Media.GradientStopCollection gs = new System.Windows.Media.GradientStopCollection();
for (int i = 0; i < count; ++i)
{
    pointColour.A = data[i];
    gs.Add(new System.Windows.Media.GradientStop(pointColour, (double)i / (double)count));
}
br.GradientStops = gs;
symbol.Fill = br;

Outcomes