private static void OnOrientationPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { TickBar bar = (TickBar)d; bar.InvalidateMeasure(); bar.InvalidateArrange(); }
private static void OnTickMarkPositionsPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { TickBar bar = (TickBar)d; double[] newValue = (double[])e.NewValue; double[] oldValue = (double[])e.OldValue; int now = newValue == null ? 0 : newValue.Length; int before = oldValue == null ? 0 : oldValue.Length; if (now < before) { while (bar.Children.Count > now) { bar.Children.RemoveAt(bar.Children.Count - 1); } } else if (newValue != null) { for (int i = before; i < now; i++) { bar.AddTickmark(newValue[i]); } } bar.InvalidateMeasure(); bar.InvalidateArrange(); }