Merge pull request #490 from Soar360/patch-2

Fix #478
This commit is contained in:
Dong Bin
2024-11-19 11:44:40 +08:00
committed by GitHub

View File

@@ -197,8 +197,6 @@ public class TagInput : TemplatedControl
_presenter = _textBox.GetTemplateChildren().OfType<TextPresenter>().FirstOrDefault();
_presenter?.GetObservable(TextPresenter.PreeditTextProperty).Subscribe(_ => CheckEmpty());
_textBox.GetObservable(TextBox.TextProperty).Subscribe(_ => CheckEmpty());
if (Tags is INotifyCollectionChanged incc)
incc.GetWeakCollectionChangedObservable().Subscribe(_ => CheckEmpty());
}
private void OnInputThemePropertyChanged(AvaloniaPropertyChangedEventArgs args)
@@ -269,6 +267,8 @@ public class TagInput : TemplatedControl
Items.Add(_textBox);
InvalidateVisual();
}
CheckEmpty();
}
private void OnTextBoxKeyDown(object? sender, KeyEventArgs args)
@@ -331,4 +331,4 @@ public class TagInput : TemplatedControl
Tags.RemoveAt(index.Value);
}
}
}
}