public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { ColorInfo cInfo = value as ColorInfo; if (cInfo == null) { return(null); } LinearGradientBrush brush = new LinearGradientBrush { GradientStops = new GradientStopCollection(), StartPoint = new Point(0, 1), EndPoint = new Point(1, 0) }; brush.GradientStops.Add(new GradientStop { Color = cInfo.Start, Offset = 0.1 }); brush.GradientStops.Add(new GradientStop { Color = cInfo.End, Offset = 1.1 }); return(brush); }
private Rectangle createColorRectangle(ColorInfo cInfo) { ColorInfoToLinearGradientBrushConverter conv = new ColorInfoToLinearGradientBrushConverter(); return createColorRectangle((LinearGradientBrush)conv.Convert(cInfo, null, null, null)); }
private Rectangle createColorRectangle(ColorInfo cInfo) { ColorInfoToLinearGradientBrushConverter conv = new ColorInfoToLinearGradientBrushConverter(); return(createColorRectangle((LinearGradientBrush)conv.Convert(cInfo, null, null, null))); }