static void OnRangeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { RoundDial g = d as RoundDial; double startAngle = g.StartAngle; double endAngle = g.EndAngle; if (g.SweepDirection == SweepDirection.Clockwise) { g.range = startAngle < endAngle ? 360 - (endAngle - startAngle) : startAngle - endAngle; } else { g.range = startAngle < endAngle ? startAngle - endAngle : (startAngle - endAngle) - 360; }; }
public override void OnApplyTemplate() { base.OnApplyTemplate(); this.scale = base.GetTemplateChild("PART_SelectionRange") as RoundDial; this.indict = base.GetTemplateChild("PART_Track") as RoundIndicator; }