#215 – Other Choices for Gradient Spreads Outside the Fill Area
February 12, 2011 1 Comment
If a gradient fill has start/stop points that lie within the control, the fill behavior outside the gradient is dictated by the SpreadMethod property of the gradient brush.
In the example below, the gradient starts at X=0.33 and stops at X=0.67. There are three different values that you can set SpreadMethod to, dictating how the control is filled at X < 0.33 and X > 0.67.
SpreadMethod = GradientSpreadMethod.Pad (the default). The colors at each end of the gradient are used to fill the rest of the control.
SpreadMethod = GradientSpreadMethod.Reflect. The gradient repeats, reversing its direction, to fill the rest of the control.
SpreadMethod = GradientSpreadMethod.Repeat. The gradient repeats, but in the original direction. As much of the gradient as will fit is used.
Pingback: Tweets that mention #215 – Other Choices for Gradient Spreads Outside the Fill Area « 2,000 Things You Should Know About WPF -- Topsy.com