/// <summary>
        /// TimeItemsSelectionProperty property changed handler.
        /// </summary>
        /// <param name="d">ListTimePickerPopup that changed its TimeItemsSelection.</param>
        /// <param name="e">Event arguments.</param>
        private static void OnTimeItemsSelectionPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ListTimePickerPopup source = (ListTimePickerPopup)d;
            ItemSelectionHelper <KeyValuePair <string, DateTime?> > oldValue = e.OldValue as ItemSelectionHelper <KeyValuePair <string, DateTime?> >;
            ItemSelectionHelper <KeyValuePair <string, DateTime?> > newValue = e.NewValue as ItemSelectionHelper <KeyValuePair <string, DateTime?> >;

            if (!source._allowWritingTimeItemsSelection)
            {
                // set back original value
                source.TimeItemsSelection = oldValue;

                throw new ArgumentException(Properties.Resources.ListTimePickerPopup_TimeItemsSelection_ReadOnly);
            }

            source.TimeItemsSelectionPropertyChanged(oldValue, newValue);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ListTimePickerPopupAutomationPeer"/> class.
 /// </summary>
 /// <param name="owner">The owner.</param>
 public ListTimePickerPopupAutomationPeer(ListTimePickerPopup owner) : base(owner)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ListTimePickerPopupAutomationPeer"/> class.
 /// </summary>
 /// <param name="owner">The owner.</param>
 public ListTimePickerPopupAutomationPeer(ListTimePickerPopup owner) : base(owner)
 {
 }
Example #4
0
        void btnSelectDateTime_Click(object sender, RoutedEventArgs e)
        {
            StackPanel pnl = new StackPanel();
            pnl.Orientation = Orientation.Horizontal;

            //InnerTimePicker.Width = 50;
            //StackPanel spSpliter = new StackPanel();
            //spSpliter.Width = 5;
            //InnerDatePicker = new SmtDatePicker();
            //InnerDatePicker.Style = Application.Current.Resources["DatePickerStyle"] as Style;
            //InnerDatePicker.Margin = new Thickness(0, 0, 5, 0);
            //InnerDatePicker.MinWidth = 110;
            InnerDatePicker = new Calendar();
            //InnerDatePicker.Style = Application.Current.Resources["DatePickerStyle"] as Style;
            InnerDatePicker.Margin = new Thickness(0, 0, 5, 0);
            InnerDatePicker.SelectedDate = DateTime.Now;
            //InnerDatePicker.MinWidth = 110;

            InnerTimePicker = new ListTimePickerPopup();
            InnerTimePicker.Value = DateTime.Parse("8:30");
            InnerTimePicker.Margin = new Thickness(0, 0, 0, 0);
            InnerTimePicker.MinWidth = 170;
            InnerTimePicker.MinHeight = 155;

            Button btnClose = new Button();
            btnClose.Style = Application.Current.Resources["CommonButtonStyle"] as Style;
            btnClose.BorderThickness =new Thickness(1);
            btnClose.Click += new RoutedEventHandler(btnClose_Click);
            btnClose.MinWidth = 30;
            btnClose.Content = "确定";



            pnl.Children.Add(InnerDatePicker);
            //pnl.Children.Add(spSpliter);
            pnl.Children.Add(InnerTimePicker);
            pnl.Children.Add(btnClose);
            //this.Content = pnl;
            EndUpdate();

            windowSelectdateTime.Content = pnl;

            double browserHeight = this.txtDateTime.ActualHeight;
            double browserWidth = this.txtDateTime.ActualWidth;
            windowSelectdateTime.Margin = new Thickness(browserWidth, browserHeight, 0, 0);
            windowSelectdateTime.Show();
            windowSelectdateTime.Loaded += new RoutedEventHandler(windowSelectdateTime_Loaded);
        }