Esempio n. 1
0
        /// <summary>
        ///     When overridden in a derived class, is invoked whenever application code or internal processes call
        ///     <see cref="M:System.Windows.FrameworkElement.ApplyTemplate" />.
        /// </summary>
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            UnSubscribeEvents();

            _popup        = GetTemplateChild(ElementPopup) as Popup;
            _button       = GetTemplateChild(ElementButton) as Button;
            _hourInput    = GetTemplateChild(ElementHourPicker) as Selector;
            _minuteInput  = GetTemplateChild(ElementMinutePicker) as Selector;
            _secondInput  = GetTemplateChild(ElementSecondPicker) as Selector;
            _hourHand     = GetTemplateChild(ElementHourHand) as FrameworkElement;
            _ampmSwitcher = GetTemplateChild(ElementAmPmSwitcher) as Selector;
            _minuteHand   = GetTemplateChild(ElementMinuteHand) as FrameworkElement;
            _secondHand   = GetTemplateChild(ElementSecondHand) as FrameworkElement;
            _textBox      = GetTemplateChild(ElementTextBox) as DatePickerTextBox;

            SetHandVisibility(HandVisibility);
            SetPickerVisibility(PickerVisibility);

            SetHourPartValues(SelectedTime.GetValueOrDefault());
            WriteValueToTextBox();

            SetDefaultTimeOfDayValues();
            SubscribeEvents();
            ApplyCulture();
            ApplyBindings();
        }
Esempio n. 2
0
 private void OnSelectedDatesChanged(object sender, SelectionChangedEventArgs e)
 {
     if (e.AddedItems != null)
     {
         var dt = (DateTime)e.AddedItems[0];
         dt           = dt.Add(SelectedTime.GetValueOrDefault());
         SelectedDate = dt;
     }
 }
Esempio n. 3
0
 private DateTime GetCorrectDateTime()
 {
     return(SelectedDate.GetValueOrDefault(DateTime.Today).Date + SelectedTime.GetValueOrDefault());
 }