コード例 #1
0
        //时间值变化
        private static void SelectedTimeChangedCb(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            CustomDateTimePicker host = (CustomDateTimePicker)d;
            TimeSpan             ts   = (TimeSpan)e.NewValue;

            host._IsUpdatingTime = true;
            host.Hour            = ts.Hours;
            host.Minute          = ts.Minutes;
            host.Second          = ts.Seconds;
            host._IsUpdatingTime = false;

            host.UpdateSelectedDateTime();
        }
コード例 #2
0
        //日期值变化
        private static void SelectedDateChangedCb(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            CustomDateTimePicker host = (CustomDateTimePicker)d;
            DateTime             dt   = (DateTime)e.NewValue;

            host._IsUpdatingDate = true;
            host.Year            = dt.Year;
            host.Month           = dt.Month;
            host.Day             = dt.Day;
            host._IsUpdatingDate = false;

            host.UpdateSelectedDateTime();
        }