add prevalidation property
MODIFY
WalletWasabi.Fluent/Controls/TagsBox.axaml.cs
WalletWasabi.Fluent/Controls/TagsBox.axaml.cs
@@ -33,6 +33,9 @@ namespace WalletWasabi.Fluent.Controls
private IEnumerable<string>? _topItems;
private bool _requestAdd;
+ public static readonly StyledProperty<bool> IsCurrentTextValidProperty =
+ AvaloniaProperty.Register<TagsBox, bool>(nameof(IsCurrentTextValid));
+
public static readonly DirectProperty<TagsBox, bool> RequestAddProperty =
AvaloniaProperty.RegisterDirect<TagsBox, bool>(nameof(RequestAdd), o => o.RequestAdd);
@@ -87,6 +90,12 @@ namespace WalletWasabi.Fluent.Controls
set => SetAndRaise(ItemsProperty, ref _items, value);
}
+ public bool IsCurrentTextValid
+ {
+ get => GetValue(IsCurrentTextValidProperty);
+ private set => SetValue(IsCurrentTextValidProperty, value);
+ }
+
public bool RequestAdd
{
get => _requestAdd;
@@ -232,10 +241,19 @@ namespace WalletWasabi.Fluent.Controls
});
_autoCompleteBox.WhenAnyValue(x => x.Text)
- .Subscribe(_ => InvalidateWatermark())
+ .Subscribe(_ =>
+ {
+ InvalidateWatermark();
+ CheckIsCurrentTextValid();
+ })
.DisposeWith(_compositeDisposable);
}
+ private void CheckIsCurrentTextValid()
+ {
+ IsCurrentTextValid = !string.IsNullOrEmpty(CurrentText.ParseLabel());
+ }
+
private void OnKeyDown(object? sender, KeyEventArgs e)
{
if (!_isInputEnabled && e.Key != Key.Back)

add prevalidation property