finally fix focus
MODIFY
WalletWasabi.Fluent/Controls/TagsBox.xaml
WalletWasabi.Fluent/Controls/TagsBox.xaml
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:c="clr-namespace:WalletWasabi.Fluent.Controls"
- xmlns:vmt="clr-namespace:WalletWasabi.Fluent.ViewModels.TagsBox"
- xmlns:i="clr-namespace:Avalonia.Xaml.Interactivity;assembly=Avalonia.Xaml.Interactivity"
- xmlns:ia="clr-namespace:Avalonia.Xaml.Interactions.Core;assembly=Avalonia.Xaml.Interactions"
- xmlns:iac="clr-namespace:Avalonia.Xaml.Interactions.Custom;assembly=Avalonia.Xaml.Interactions.Custom">
+ xmlns:c="clr-namespace:WalletWasabi.Fluent.Controls">
<Style Selector="c|TagsBox">
<Setter Property="Foreground" Value="{DynamicResource TextControlForeground}" />
<Setter Property="Background" Value="{DynamicResource TextControlBackground}" />
<Setter Property="MinHeight" Value="{DynamicResource TextControlThemeMinHeight}" />
<Setter Property="MinWidth" Value="{DynamicResource TextControlThemeMinWidth}" />
<Setter Property="Padding" Value="{DynamicResource TextControlThemePadding}" />
+ <Setter Property="Focusable" Value="True" />
<Setter Property="Cursor" Value="IBeam" />
<Setter Property="Template">
<ControlTemplate>
<Setter Property="BorderThickness" Value="{DynamicResource TextControlBorderThemeThicknessFocused}" />
</Style>
- <Style Selector="c|TagsBox:error /template/ Border#PART_BorderElement">
+ <Style Selector="c|TagsBox:error /template/ Border#PART_Border">
<Setter Property="BorderBrush" Value="{DynamicResource SystemControlErrorTextForegroundBrush}" />
</Style>
- <Style Selector="c|TagsBox:pointerover /template/ Border#PART_BorderElement">
- <Setter Property="BorderBrush" Value="{DynamicResource TextControlBorderBrushPointerOver}" />
- <Setter Property="Background" Value="{DynamicResource TextControlBackgroundPointerOver}" />
- </Style>
-
<Style Selector="c|TagsBox AutoCompleteBox">
<Setter Property="Background" Value="{x:Null}" />
<Setter Property="Padding" Value="3,10,0, 10" />

MODIFY
WalletWasabi.Fluent/Controls/TagsBox.xaml.cs
WalletWasabi.Fluent/Controls/TagsBox.xaml.cs
@@ -96,8 +96,6 @@ namespace WalletWasabi.Fluent.Controls
_autoCompleteBox.AddDisposableHandler(TextInputEvent, OnTextInput,
RoutingStrategies.Tunnel);
- _autoCompleteBox.Focus();
-
}
@@ -109,7 +107,6 @@ namespace WalletWasabi.Fluent.Controls
private void OnACBGotFocus(object? sender, GotFocusEventArgs e)
{
PseudoClasses.Set(":focus", true);
-
}
private void OnTextInput(object? sender, TextInputEventArgs e)
@@ -197,7 +194,6 @@ namespace WalletWasabi.Fluent.Controls
var wasFocused = _isFocused;
_isFocused = hasFocus;
-
if (hasFocus)
{
if (!wasFocused)
@@ -205,8 +201,8 @@ namespace WalletWasabi.Fluent.Controls
_autoCompleteBox?.Focus();
}
}
- PseudoClasses.Set(":focus", hasFocus);
+ PseudoClasses.Set(":focus", hasFocus);
_isFocused = hasFocus;
}
@@ -223,12 +219,9 @@ namespace WalletWasabi.Fluent.Controls
AddTag(currentText.Trim());
BackspaceLogicClear();
- _autoCompleteBox.ClearValue(AutoCompleteBox.SelectedItemProperty);
- Dispatcher.UIThread.Post((() =>
- {
- _autoCompleteBox.ClearValue(AutoCompleteBox.TextProperty);
- }));
+ _autoCompleteBox.ClearValue(AutoCompleteBox.SelectedItemProperty);
+ Dispatcher.UIThread.Post(() => { _autoCompleteBox.ClearValue(AutoCompleteBox.TextProperty); });
}
private void BackspaceLogicClear()
@@ -273,19 +266,19 @@ namespace WalletWasabi.Fluent.Controls
switch (e.Key)
{
case Key.Back when _backspaceEmptyField1 && _backspaceEmptyField2:
+
RemoveTag();
+
break;
case Key.Enter when _isInputEnabled && !string.IsNullOrEmpty(strTrimmed):
+
if (RestrictInputToSuggestions && !Suggestions.Cast<string>().Any(x =>
x.Equals(strTrimmed, StringComparison.InvariantCultureIgnoreCase)))
break;
BackspaceLogicClear();
-
AddTag(strTrimmed);
-
Dispatcher.UIThread.Post(() => { _autoCompleteBox?.ClearValue(AutoCompleteBox.TextProperty); });
-
break;
}
}

finally fix focus