private static void OnTimeFormatChanged(DependencyObject dependencyObject,
                                                DependencyPropertyChangedEventArgs e)
        {
            TimeSpanTextBoxBehaviour timeTextBoxBehaviour = GetTimeTextBoxBehaviour(dependencyObject);

            timeTextBoxBehaviour.TimeFormatChanged((TimerFormats)e.NewValue);
        }
        private static void OnMaxTimeChanged(DependencyObject dependencyObject,
                                             DependencyPropertyChangedEventArgs e)
        {
            TimeSpanTextBoxBehaviour timeTextBoxBehaviour = GetTimeTextBoxBehaviour(dependencyObject);
            var      timeString = (string)e.NewValue;
            TimeSpan timeSpan   = TimeSpanParse(timeString, false);

            timeTextBoxBehaviour.MaxTimeSpanChanged(timeSpan);
        }
        public static TimeSpanTextBoxBehaviour GetTimeTextBoxBehaviour(object textBox)
        {
            TextBox castTextBox = (TextBox)textBox;
            TimeSpanTextBoxBehaviour control = GetTimeTextBoxBehaviour(castTextBox);

            if (control == null)
            {
                control = new TimeSpanTextBoxBehaviour(castTextBox);
                SetTimeTextBoxBehaviour(castTextBox, control);
            }
            return(control);
        }
 private static void OnValueChanged(DependencyObject dependencyObject,
                                    DependencyPropertyChangedEventArgs e)
 {
     TimeSpanTextBoxBehaviour timeTextBoxBehaviour = GetTimeTextBoxBehaviour(dependencyObject);
 }
 private static void SetTimeTextBoxBehaviour(DependencyObject o, TimeSpanTextBoxBehaviour value)
 {
     o.SetValue(TimeTextBoxBehaviourProperty, value);
 }