10
10
public class ShadowBorderDecorator : Decorator
12
private static SolidColorBrush backgroundBrush;
13
private static LinearGradientBrush leftBrush;
14
private static LinearGradientBrush topBrush;
15
private static LinearGradientBrush rightBrush;
16
private static LinearGradientBrush bottomBrush;
17
private static RadialGradientBrush topLeftBrush;
18
private static RadialGradientBrush topRightBrush;
19
private static RadialGradientBrush bottomLeftBrush;
20
private static RadialGradientBrush bottomRightBrush;
12
private SolidColorBrush backgroundBrush;
13
private LinearGradientBrush leftBrush;
14
private LinearGradientBrush topBrush;
15
private LinearGradientBrush rightBrush;
16
private LinearGradientBrush bottomBrush;
17
private RadialGradientBrush topLeftBrush;
18
private RadialGradientBrush topRightBrush;
19
private RadialGradientBrush bottomLeftBrush;
20
private RadialGradientBrush bottomRightBrush;
22
22
static ShadowBorderDecorator()
24
24
MarginProperty.OverrideMetadata(typeof(ShadowBorderDecorator), new FrameworkPropertyMetadata(new Thickness(6)));
27
public ShadowBorderDecorator()
29
private static void CreateBrushes()
36
public byte StartAlpha
48
private void CreateBrushes()
31
50
// Create gradient stops for given shadow color.
32
var shadowColor = Color.FromArgb(128, 0, 0, 0);
33
var transparentColor = Color.FromArgb(0, 0, 0, 0);
51
var shadowColor = Color.FromArgb(this.StartAlpha, 0, 0, 0);
52
var transparentColor = Color.FromArgb(this.EndAlpha, 0, 0, 0);
34
53
var gradientStops = new GradientStopCollection(2)
36
55
new GradientStop(shadowColor, 0),