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

UpdateLengthIndicatorVisibility() private method

private UpdateLengthIndicatorVisibility ( ) : void
return void
        private void UpdateLengthIndicatorVisibility()
        {
            if (_rootGrid == null || _lengthIndicator == null)
            {
                return;
            }

            bool isHidden = true;
            if (LengthIndicatorVisible)
            {
                // The current implementation is culture invariant.
                _lengthIndicator.Text = String.Format(
                    CultureInfo.InvariantCulture,
                    "{0}/{1}", Text.Length, 
                    ((DisplayedMaxLength > 0) ? DisplayedMaxLength : MaxLength));

                if (Text.Length >= LengthIndicatorThreshold)
                {
                    isHidden = false;
                }
            }

            VisualStateManager.GoToState(this, isHidden ? LengthIndicatorHiddenState : LengthIndicatorVisibleState, false);
        }