public override void OnApplyTemplate() { base.OnApplyTemplate(); this.TimeSlider = this.GetTemplateChild(PART_TimeSlider) as TimeSlider; DependencyPropertyDescriptor.FromProperty(TimeSlider.PositionProperty, typeof(Player)) .AddValueChanged(this.TimeSlider, this.OnTimeSliderPostionChanged); }
private static object OnPositionCoerceValueChanged(DependencyObject d, object baseValue) { TimeSlider timeSlider = d as TimeSlider; TimeSpan timeSpan = (TimeSpan)baseValue; if (timeSpan <= timeSlider.Duration) { return(timeSpan); } return(timeSlider.Duration); }
private static void OnPositionPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { TimeSlider timeSlider = d as TimeSlider; timeSlider.UpdatePosition((TimeSpan)e.NewValue); }