示例#1
0
        private static void OnSelectedTimePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            RadClock radClock = d as RadClock;

            if (!radClock.IsReadOnly)
            {
                if (radClock != null)
                {
                    radClock.OnSelectedTimeChanged();
                }
            }
        }
示例#2
0
        private static void OnStartTimeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            RadClock clock = d as RadClock;

            if (clock == null)
            {
                return;
            }

            if (clock.ItemsSource != null)
            {
                clock.ItemsSource = clock.GenerateItemsSource();
            }
        }
示例#3
0
        private static void OnTimeIntervalChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            RadClock clock = d as RadClock;

            if (clock == null)
            {
                return;
            }

            // NOTE: This cannot be true! TimeInterval is of type TimeSpan which is not nullable!
            if (clock.TimeInterval != null)
            {
                clock.TimeInterval = clock.ValidateTimeSpan(clock.TimeInterval);
            }
            if (clock.ItemsSource != null)
            {
                clock.ItemsSource = clock.GenerateItemsSource();
            }
        }
示例#4
0
        private void RadClock_KeyDown(object sender, KeyEventArgs e)
        {
            RadClock clock = sender as RadClock;
            TimeSpan?selectedItem;

            if (this.SelectedTime != null)
            {
                selectedItem = clock.SelectedTime;
            }
            else
            {
                selectedItem = this.SelectedTime;
            }
            int index = this.Items.IndexOf(selectedItem);

            switch (e.Key)
            {
            case System.Windows.Input.Key.Right:
                this.ProcessKey(index + 1);
                e.Handled = true;
                break;

            case System.Windows.Input.Key.Left:
                this.ProcessKey(index - 1);
                e.Handled = true;
                break;

            case System.Windows.Input.Key.Home:
                this.ProcessKey(0);
                e.Handled = true;
                break;

            case System.Windows.Input.Key.End:
                this.ProcessKey(this.Items.Count - 1);
                e.Handled = true;
                break;

            default:
                break;
            }
        }