Example #1
0
        /// <summary>
        /// TextProperty property changed handler.
        /// </summary>
        /// <param name="d">Date picker or time picker that changed its Text.</param>
        /// <param name="e">The DependencyPropertyChangedEventArgs.</param>
        private static void OnTextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            INTERNAL_DateTimePickerBase dp = (INTERNAL_DateTimePickerBase)d;

            if (dp.IsHandlerSuspended(TextProperty))
            {
                return;
            }

            string newText = (string)e.NewValue;

            if (string.IsNullOrEmpty(newText))
            {
                dp.OnEmptyText();
            }
            else
            {
                if (dp._textBox != null)
                {
                    dp._textBox.Text = newText;
                }
                else
                {
                    dp._defaultText = newText;
                }

                dp.OnTextChanged();
            }
        }
Example #2
0
        /// <summary>
        /// TextProperty property changed handler.
        /// </summary>
        /// <param name="d">Date picker or time picker that changed its Text.</param>
        /// <param name="e">The DependencyPropertyChangedEventArgs.</param>
        private static void OnTextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            INTERNAL_DateTimePickerBase dp = (INTERNAL_DateTimePickerBase)d;

            string newText = (string)e.NewValue;

            if (dp._textBox != null)
            {
                //if (newText == dp._defaultText)
                //    dp._textBox.Foreground = new SolidColorBrush(Colors.Gray);
                //else
                //    dp._textBox.Foreground = new SolidColorBrush(Colors.Black);

                dp._textBox.Text = newText;
            }
        }
        /// <summary>
        /// IsDropDownOpenProperty property changed handler.
        /// </summary>
        /// <param name="d">the control that changed its IsDropDownOpen.</param>
        /// <param name="e">The DependencyPropertyChangedEventArgs.</param>
        protected static void OnIsDropDownOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            INTERNAL_DateTimePickerBase dp = d as INTERNAL_DateTimePickerBase;
            bool newValue = (bool)e.NewValue;

            if (dp._popup != null && dp._popup.Child != null)
            {
                if (newValue)
                {
                    dp.OpenDropDown();
                }
                else
                {
                    dp.CloseDropDown();
                }
            }
        }