private SolidColorBrush GetBrush(HierarchicalData data) { if (Highlighing != null && Highlighing.IsHighlighted(data)) { return(DefaultDrawingPrimitives.HighlightBrush); } SolidColorBrush brush; if (data.ColorKey != null) { brush = _colorScheme.GetMediaBrush(data.ColorKey); } else { // For non leaf nodes the weight is 0. We only can merge area metrics. // See HiearchyBuilder.InsertLeaf. var color = DefaultDrawingPrimitives.WhiteToRedGradient.GradientStops.GetRelativeColor(data.NormalizedWeightMetric); brush = new SolidColorBrush(color); brush.Freeze(); } return(brush); }