private static void OnActionIconChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
        {
            PhoneTextBox phoneTextBox = sender as PhoneTextBox;

            if (phoneTextBox != null)
            {
                phoneTextBox.UpdateActionIconVisibility();
            }
        }
        private static void DisplayedMaxLengthChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
        {
            PhoneTextBox phoneTextBox = sender as PhoneTextBox;

            if (phoneTextBox.DisplayedMaxLength > phoneTextBox.MaxLength && phoneTextBox.MaxLength > 0)
            {
                throw new ArgumentOutOfRangeException("DisplayedMaxLength", "The displayed maximum length cannot be greater than the MaxLength.");
            }
        }
        private static void OnLengthIndicatorThresholdChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
        {
            PhoneTextBox phoneTextBox = sender as PhoneTextBox;

            if (phoneTextBox._ignorePropertyChange)
            {
                phoneTextBox._ignorePropertyChange = false;
                return;
            }

            if (phoneTextBox.LengthIndicatorThreshold < 0)
            {
                phoneTextBox._ignorePropertyChange = true;
                phoneTextBox.SetValue(LengthIndicatorThresholdProperty, args.OldValue);

                throw new ArgumentOutOfRangeException("LengthIndicatorThreshold", "The length indicator visibility threshold must be greater than zero.");
            }
        }
        private static void OnLengthIndicatorVisibleChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
        {
            PhoneTextBox phoneTextBox = sender as PhoneTextBox;

            phoneTextBox.UpdateLengthIndicatorVisibility();
        }