Microsoft.Phone.Controls.PhoneTextBox.DisplayedMaxLengthChanged C# (CSharp) Method

DisplayedMaxLengthChanged() private method

private DisplayedMaxLengthChanged ( DependencyObject sender, System.Windows.DependencyPropertyChangedEventArgs args ) : void
sender System.Windows.DependencyObject
args System.Windows.DependencyPropertyChangedEventArgs
return void
        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.");
            }
        }