WPF中通过代码设置控件背景渐层颜色

				LinearGradientBrush brush = new LinearGradientBrush();
                brush.StartPoint = new Point(0, 0);
                brush.EndPoint = new Point(0, 1);
                brush.GradientStops.Add(new GradientStop(Color.FromRgb(111, 115, 119), 0.1));
                brush.GradientStops.Add(new GradientStop(Color.FromRgb(173, 177, 182), 0.1));
                source._border.Background = brush;

你可能感兴趣的:(WPF)