protected override Size MeasureOverride(Size availableSize) { if (this.AllTexts == null || !this.AllTexts.Any()) { return new Size(0, 0); } var textHeight = Math.Ceiling(this.FontSize * this.FontFamily.LineSpacing); double w = 0; double h = 0; switch (this.TextOrientation) { case TextOrientation.VerticalUp: case TextOrientation.VerticalDown: w = textHeight; h = this.AllTexts.Max(t => t.Width); this.TextSpace = textHeight; break; case TextOrientation.Horizontal: case TextOrientation.Tangential: case TextOrientation.RadialOut: w = this.AllTexts.Max(x => x.Width); h = textHeight; this.TextSpace = w; break; default: throw new ArgumentOutOfRangeException(); } var margin = this.TextSpace / 2; switch (this.Placement) { case TickBarPlacement.Left: case TickBarPlacement.Right: this.TextSpaceMargin = new Thickness(0, margin, 0, margin); break; case TickBarPlacement.Top: case TickBarPlacement.Bottom: this.TextSpaceMargin = new Thickness(margin, 0, margin, 0); break; default: throw new ArgumentOutOfRangeException(); } var size = new Size(w, h); if (size.IsInvalid()) { return new Size(0, 0); } return size; }