예제 #1
0
        private static void SelectedDayChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            DateSelector timeSelector = d as DateSelector;

            timeSelector.Day = e.NewValue == null ? 0 : (int)e.NewValue;
            timeSelector.SetSelectedDate();
        }
예제 #2
0
        private static void SelectedTimeChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            DateSelector timeSelector = d as DateSelector;
            DateTime     dt           = (DateTime)e.NewValue;

            timeSelector.SetButtonSelected();

            timeSelector.OnSelectedTimeChanged((DateTime?)e.OldValue, (DateTime?)e.NewValue);
        }
예제 #3
0
 private static object CoerceMonthValueCallback(DependencyObject d, object baseValue)
 {
     if ((int)baseValue < 1)
     {
         DateSelector timeSelector = d as DateSelector;
         timeSelector.Year--;
         return(12);
     }
     return(baseValue);
 }
예제 #4
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            //this.PART_TextBox = this.GetTemplateChild("PART_TextBox") as TextBlock;
            this.PART_DateSelector = this.GetTemplateChild("PART_DateSelector") as DateSelector;
            this.PART_Popup        = this.GetTemplateChild("PART_Popup") as Popup;
            if (DateMode == DateMode.None)
            {
                PART_PreviousButton       = this.GetTemplateChild("PART_NextButton") as Button;
                PART_NextButton           = this.GetTemplateChild("PART_PreviousButton") as Button;
                PART_TextBox              = this.GetTemplateChild("PART_TextBox") as NumbericTextBox;
                PART_TextBox.TextChanged += PART_TextBox_TextChanged;
            }
            else
            {
                PART_PreviousButton = this.GetTemplateChild("PART_PreviousButton") as Button;
                PART_NextButton     = this.GetTemplateChild("PART_NextButton") as Button;
            }
            if (this.PART_DateSelector != null)
            {
                this.PART_DateSelector.Owner = this;
                this.PART_DateSelector.SelectedTimeChanged += PART_DateSelector_SelectedTimeChanged;
                if (PART_PreviousButton != null)
                {
                    this.PART_PreviousButton.AddHandler(MouseLeftButtonDownEvent, new RoutedEventHandler(PART_PreviousButton_Click), true);
                }
                if (PART_NextButton != null)
                {
                    this.PART_NextButton.AddHandler(MouseLeftButtonDownEvent, new RoutedEventHandler(PART_NextButton_Click), true);
                }
            }
            if (this.PART_Popup != null)
            {
                this.PART_Popup.Opened += PART_Popup_Opened;
            }
            if (SelectedTime == null)
            {
                SelectedTime = Global.SystemTime;
            }
        }