prefer AvaloniaList.RemoveRange for the performance.
This commit is contained in:
@@ -166,11 +166,14 @@ public class TagInput : TemplatedControl
|
|||||||
var newTags = args.GetNewValue<IList<string>>();
|
var newTags = args.GetNewValue<IList<string>>();
|
||||||
var oldTags = args.GetOldValue<IList<string>>();
|
var oldTags = args.GetOldValue<IList<string>>();
|
||||||
|
|
||||||
// remove all tags except the textbox
|
if (Items is AvaloniaList<object> avaloniaList)
|
||||||
int count = Items.Count;
|
|
||||||
for (int i = 0; i < count - 1; i++)
|
|
||||||
{
|
{
|
||||||
Items.RemoveAt(0);
|
avaloniaList.RemoveRange(0, avaloniaList.Count - 1);
|
||||||
|
}
|
||||||
|
else if (Items.Count != 0)
|
||||||
|
{
|
||||||
|
Items.Clear();
|
||||||
|
Items.Add(_textBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newTags != null)
|
if (newTags != null)
|
||||||
|
|||||||
Reference in New Issue
Block a user