private static double AddLabel(string caption, double[] margins, double height, ref double lastColumnMaxWidth, bool selected = false, double points = 0, bool perModel = false, bool bold = false, string addLine = "", int fixPadding = 0, bool enabled = true) { Label newOption = new Label(); string[] captionLines = Other.WordSplit(caption); newOption.Content = String.Empty; foreach (string line in captionLines) { newOption.Content += (String.IsNullOrEmpty(newOption.Content.ToString()) ? String.Empty : Environment.NewLine + " ") + line; } newOption.Margin = Changes.Thick(newOption, margins[0], margins[1]); if (!enabled) { newOption.Foreground = Brushes.Gray; } else if (selected) { newOption.Foreground = ArmyBook.Data.AdditionalColor; } if (selected || bold) { newOption.FontWeight = FontWeights.Bold; } if (bold) { newOption.Foreground = Brushes.White; newOption.Background = ArmyBook.Data.MainColor; } Changes.main.unitDetail.Children.Add(newOption); Changes.main.UpdateLayout(); double actualWidth = newOption.ActualWidth; if (points > 0 || points < 0 || !String.IsNullOrEmpty(addLine)) { double leftPadding = (points > 0 ? -5 : 5); bool pointsNeed = (points > 0) || (points < 0); Label optionPoints = new Label { Content = (pointsNeed ? points.ToString() + " pts" + (perModel ? "/m" : String.Empty) : addLine) }; optionPoints.Margin = Changes.Thick(optionPoints, margins[0] + newOption.ActualWidth + leftPadding, margins[1]); if (!enabled) { optionPoints.Foreground = Brushes.Gray; } else { optionPoints.Foreground = ArmyBook.Data.MainColor; } Changes.main.unitDetail.Children.Add(optionPoints); Changes.main.UpdateLayout(); actualWidth += optionPoints.ActualWidth - 5; } if (captionLines.Length > 1) { Line longOptionLine = new Line { X1 = newOption.Margin.Left + 8, Y1 = newOption.Margin.Top + height + 8 }; longOptionLine.X2 = longOptionLine.X1; longOptionLine.Y2 = longOptionLine.Y1 + height * (captionLines.Length - 1); longOptionLine.StrokeThickness = 2; longOptionLine.Stroke = ArmyBook.Data.MainColor; Changes.main.unitDetail.Children.Add(longOptionLine); } if (actualWidth > lastColumnMaxWidth) { lastColumnMaxWidth = actualWidth; } double bottomPadding = (captionLines.Length > 1 ? 5 : 0); return((height * captionLines.Length) + bottomPadding + fixPadding); }