Skip to content

Commit 01c413b

Browse files
committed
bugfix bug fixes
1 parent 07f19d5 commit 01c413b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Microsoft.Toolkit.Uwp.UI.Controls.Input/TokenizingTextBox/TokenizingTextBox.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ public async Task ClearAsync()
440440

441441
internal async Task AddTokenAsync(object data, bool? atEnd = null)
442442
{
443-
if (ReadLocalValue(MaxTokensProperty) == DependencyProperty.UnsetValue || MaxTokens <= 0)
443+
if (ReadLocalValue(MaxTokensProperty) != DependencyProperty.UnsetValue && MaxTokens <= 0)
444444
{
445445
// No tokens for you
446446
return;
@@ -465,7 +465,7 @@ internal async Task AddTokenAsync(object data, bool? atEnd = null)
465465
// If we've been typing in the last box, just add this to the end of our collection
466466
if (atEnd == true || _currentTextEdit == _lastTextEdit)
467467
{
468-
if (ReadLocalValue(MaxTokensProperty) != DependencyProperty.UnsetValue && _innerItemsSource.ItemsSource.Count > MaxTokens)
468+
if (ReadLocalValue(MaxTokensProperty) != DependencyProperty.UnsetValue && _innerItemsSource.ItemsSource.Count >= MaxTokens)
469469
{
470470
// Remove tokens from the end until below the max number.
471471
for (var i = _innerItemsSource.Count - 2; i >= 0; --i)
@@ -493,7 +493,7 @@ internal async Task AddTokenAsync(object data, bool? atEnd = null)
493493
var edit = _currentTextEdit;
494494
var index = _innerItemsSource.IndexOf(edit);
495495

496-
if (ReadLocalValue(MaxTokensProperty) != DependencyProperty.UnsetValue && _innerItemsSource.ItemsSource.Count > MaxTokens)
496+
if (ReadLocalValue(MaxTokensProperty) != DependencyProperty.UnsetValue && _innerItemsSource.ItemsSource.Count >= MaxTokens)
497497
{
498498
// Find the next token and remove it, until below the max number of tokens.
499499
for (var i = index; i < _innerItemsSource.Count; i++)

0 commit comments

Comments
 (0)