using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace Dominion.NET_WPF.Controls.GameLog { /// /// Interaction logic for ucIndent.xaml /// public partial class ucIndent : UserControl { public static readonly DependencyProperty IndentProperty = DependencyProperty.Register("Indent", typeof(int), typeof(ucIndent), new PropertyMetadata(0)); public int Indent { get { return (int)this.GetValue(IndentProperty); } set { this.SetValue(IndentProperty, value); this.Width = value * 12; gLines.Children.RemoveRange(2, gLines.Children.Count - 2); for (int count = 1; count < value; count++) { Line line = new Line(); line.Stretch = Stretch.Fill; line.VerticalAlignment = System.Windows.VerticalAlignment.Stretch; line.X1 = line.X2 = count * 12 + 6; line.Y1 = 0; line.Y2 = 12; line.Stroke = Brushes.Black; gLines.Children.Add(line); } } } public static readonly DependencyProperty LastElementProperty = DependencyProperty.Register("LastElement", typeof(Boolean), typeof(ucIndent), new PropertyMetadata(false)); public Boolean LastElement { get { return (Boolean)this.GetValue(LastElementProperty); } set { this.SetValue(LastElementProperty, value); if (value) { lVertical.Stretch = Stretch.None; lVertical.Y2 = 7; } else { lVertical.Stretch = Stretch.Fill; lVertical.Y2 = 12; } } } public ucIndent() { InitializeComponent(); Random r = new Random(); this.Background = new SolidColorBrush(Color.FromRgb((byte)r.Next(256), (byte)r.Next(256), (byte)r.Next(256))); } } }