Ejemplo n.º 1
0
        private static void OnTimePartPropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e)
        {
            TimeBox control  = source as TimeBox;
            int     newValue = (int)e.NewValue;
            int     oldValue = (int)e.OldValue;

            // Setting control.Time triggers OnTimePropertyChanged
            // And SetTimePars inside OnTimePropertyChanged  may call back to current method OnTimePartPropertyChanged.
            // This must be checked to avoid such a deadloop.
            if (newValue != oldValue)
            {
                control.Time = control.ComposeTime();
            }
        }
Ejemplo n.º 2
0
        private static void OnTimePropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e)
        {
            TimeBox  control  = source as TimeBox;
            TimeSpan newValue = (TimeSpan)e.NewValue;
            TimeSpan oldValue = (TimeSpan)e.OldValue;

            // SetTimeParts triggers OnTimePartPropertyChanged
            // And it sets control.Time that calls back to current method OnTimePropertyChanged.
            // This must be checked to avoid such a deadloop.
            if (newValue != oldValue)
            {
                control.SetTimeParts(newValue);
            }
        }