Skip to content

Commit ccefe38

Browse files
committed
Removing Math reference
1 parent 2d118e8 commit ccefe38

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,11 @@ private void ItemsSource_PropertyChanged(DependencyObject sender, DependencyProp
7878
{
7979
_innerItemsSource = new InterspersedObservableCollection(ItemsSource);
8080

81-
if (ReadLocalValue(MaximumTokensProperty) != DependencyProperty.UnsetValue && _innerItemsSource.ItemsSource.Count > MaximumTokens)
81+
if (ReadLocalValue(MaximumTokensProperty) != DependencyProperty.UnsetValue && _innerItemsSource.ItemsSource.Count >= MaximumTokens)
8282
{
83-
// Reduce down to the max as necessary.
84-
for (var i = _innerItemsSource.ItemsSource.Count - 1; i >= Math.Max(MaximumTokens, 0); --i)
83+
// Reduce down to below the max as necessary.
84+
var endCount = MaximumTokens > 0 ? MaximumTokens : 0;
85+
for (var i = _innerItemsSource.ItemsSource.Count - 1; i >= endCount; --i)
8586
{
8687
_innerItemsSource.Remove(_innerItemsSource[i]);
8788
}

0 commit comments

Comments
 (0)