do not allow duplication by default
MODIFY
WalletWasabi.Fluent/Controls/TagsBox.axaml.cs
WalletWasabi.Fluent/Controls/TagsBox.axaml.cs
@@ -35,6 +35,9 @@ namespace WalletWasabi.Fluent.Controls
public static readonly StyledProperty<bool> SuggestionsAreCaseSensitiveProperty =
AvaloniaProperty.Register<TagsBox, bool>(nameof(SuggestionsAreCaseSensitive), defaultValue: true);
+ public static readonly StyledProperty<bool> AllowDuplicationProperty =
+ AvaloniaProperty.Register<TagsBox, bool>(nameof(AllowDuplication));
+
public static readonly DirectProperty<TagsBox, IEnumerable<string>?> ItemsProperty =
AvaloniaProperty.RegisterDirect<TagsBox, IEnumerable<string>?>(nameof(Items),
o => o.Items,
@@ -123,6 +126,12 @@ namespace WalletWasabi.Fluent.Controls
set => SetValue(SuggestionsAreCaseSensitiveProperty, value);
}
+ public bool AllowDuplication
+ {
+ get => GetValue(AllowDuplicationProperty);
+ set => SetValue(AllowDuplicationProperty, value);
+ }
+
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
{
base.OnApplyTemplate(e);
@@ -462,6 +471,11 @@ namespace WalletWasabi.Fluent.Controls
return;
}
+ if (!AllowDuplication && x.Contains(tag))
+ {
+ return;
+ }
+
x.Add(tag);
}

do not allow duplication by default