public Brush GetBrush(bool freezing = true) { if (freezing) { SolidColorBrush brush; if (Brushes.TryGetValue(Color, out brush)) { return(brush); } brush = new SolidColorBrush(Color); brush.Freeze(); Brushes.Add(Color, brush); return(brush); } return(new SolidColorBrush(Color)); }