コード例 #1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="label"></param>
        /// <param name="property"></param>
        public DateTimeValueEditor(PropertyGridLabel label, PropertyItem property)
            : base(label, property)
        {
            currentValue = property.Value;
            property.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(property_PropertyChanged);
            property.ValueError += new EventHandler<ExceptionEventArgs>(property_ValueError);

            pnl = new StackPanel();
            this.Content = pnl;

            dtp = new DatePicker();
            dtp.Visibility = Visibility.Visible;
            dtp.Margin = new Thickness(0);
            dtp.VerticalAlignment = VerticalAlignment.Center;
            dtp.HorizontalAlignment = HorizontalAlignment.Stretch;
            dtp.CalendarOpened += new RoutedEventHandler(dtp_CalendarOpened);
            dtp.CalendarClosed += new RoutedEventHandler(dtp_CalendarClosed);
            dtp.LostFocus += new RoutedEventHandler(dtp_LostFocus);
            pnl.Children.Add(dtp);
            dtp.Focus();

            this.ShowTextBox();
        }