diff --git a/src/client/spark/view/Extensions/MarkupExtensions/BrushExtension.cs b/src/client/spark/view/Extensions/MarkupExtensions/BrushExtension.cs index c5e1062dd..5f625ffc2 100644 --- a/src/client/spark/view/Extensions/MarkupExtensions/BrushExtension.cs +++ b/src/client/spark/view/Extensions/MarkupExtensions/BrushExtension.cs @@ -2,17 +2,12 @@ using System.Collections.Generic; using System.ComponentModel; using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; using System.Windows.Markup; using System.Windows.Media; -namespace mbts.ui -{ +namespace mbts.ui { [MarkupExtensionReturnType(typeof(Brush))] - public class BrushExtension : MarkupExtension - { + class BrushExtension : MarkupExtension { public BrushExtension() : this(Colors.Black) { } public BrushExtension(Color Color) : this(Color, 1.0) { } public BrushExtension(Color Color, double Opacity) { this.Color = Color; this.Opacity = Opacity; } @@ -20,11 +15,14 @@ namespace mbts.ui [TypeConverter(typeof(ColorTypeConverter))] [ConstructorArgument("Color")] public Color Color { get; set; } + [ConstructorArgument("Opacity")] public double Opacity { get; set; } - public override object ProvideValue(IServiceProvider serviceProvider) { - return new SolidColorBrush(Color) { Opacity = Opacity }; - } + + public bool Freeze { get; set; } + + public override object ProvideValue(IServiceProvider serviceProvider) => + Freeze ? FrozenBrushCache.get_brush(Color, Opacity) : new SolidColorBrush(Color) { Opacity = Opacity }; } public class ColorTypeConverter : TypeConverter