Exemplo n.º 1
0
        private static void OnValueChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            TimeEditor control = obj as TimeEditor;

            control.Years   = ((DateTime)e.NewValue).Year;
            control.Months  = ((DateTime)e.NewValue).Month;
            control.Days    = ((DateTime)e.NewValue).Day;
            control.Hours   = ((DateTime)e.NewValue).Hour;
            control.Minutes = ((DateTime)e.NewValue).Minute;
        }
Exemplo n.º 2
0
        private static void OnTimeChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            TimeEditor control = obj as TimeEditor;

            if (control.Hours > 23)
            {
                control.Hours = 23;
            }
            if (control.Minutes > 59)
            {
                control.Minutes = 59;
            }
            control.Value = new DateTime(control.Years, control.Months, control.Days, control.Hours, control.Minutes, 0);
        }