File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Microsoft.Toolkit.Uwp.UI.Controls.Input/TokenizingTextBox Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -440,7 +440,7 @@ public async Task ClearAsync()
440
440
441
441
internal async Task AddTokenAsync ( object data , bool ? atEnd = null )
442
442
{
443
- if ( ReadLocalValue ( MaxTokensProperty ) == DependencyProperty . UnsetValue || MaxTokens <= 0 )
443
+ if ( ReadLocalValue ( MaxTokensProperty ) != DependencyProperty . UnsetValue && MaxTokens <= 0 )
444
444
{
445
445
// No tokens for you
446
446
return ;
@@ -465,7 +465,7 @@ internal async Task AddTokenAsync(object data, bool? atEnd = null)
465
465
// If we've been typing in the last box, just add this to the end of our collection
466
466
if ( atEnd == true || _currentTextEdit == _lastTextEdit )
467
467
{
468
- if ( ReadLocalValue ( MaxTokensProperty ) != DependencyProperty . UnsetValue && _innerItemsSource . ItemsSource . Count > MaxTokens )
468
+ if ( ReadLocalValue ( MaxTokensProperty ) != DependencyProperty . UnsetValue && _innerItemsSource . ItemsSource . Count >= MaxTokens )
469
469
{
470
470
// Remove tokens from the end until below the max number.
471
471
for ( var i = _innerItemsSource . Count - 2 ; i >= 0 ; -- i )
@@ -493,7 +493,7 @@ internal async Task AddTokenAsync(object data, bool? atEnd = null)
493
493
var edit = _currentTextEdit ;
494
494
var index = _innerItemsSource . IndexOf ( edit ) ;
495
495
496
- if ( ReadLocalValue ( MaxTokensProperty ) != DependencyProperty . UnsetValue && _innerItemsSource . ItemsSource . Count > MaxTokens )
496
+ if ( ReadLocalValue ( MaxTokensProperty ) != DependencyProperty . UnsetValue && _innerItemsSource . ItemsSource . Count >= MaxTokens )
497
497
{
498
498
// Find the next token and remove it, until below the max number of tokens.
499
499
for ( var i = index ; i < _innerItemsSource . Count ; i ++ )
You can’t perform that action at this time.
0 commit comments