I want to draw a Polyline in WPF which has a different opacity between its beginning and end. I used the LinearGradientBrush for it. However this doesn't correspond to my expectations. The gradient takes into account the position in the bounding box or in the container. Is it possible to have a gradient based on the "length" (between the beginning and end) from a polyline?
Asked
Active
Viewed 828 times
2 Answers
1
Take a look at GradientBrush.MappingMode Property. The default is BrushMappingMode.RelativeToBoundingBox
and you want BrushMappingMode.Absolute
.

LPL
- 16,827
- 6
- 51
- 95
-
nop this property doesn't solve my problem. My polyline can do anything and especially goes back. In BrushMappingMode.Absolute you must define the starting point and the end point but if your polyline goes back it doesn't work. – theskull31 Aug 10 '12 at 14:00
0
Try Charles Petzold's GradientPath. But it's a FrameworkElement
, so cannot be used exactly like the Polyline
.

xmedeko
- 7,336
- 6
- 55
- 85