Make labels selectable
MODIFY
WalletWasabi.Gui/Behaviors/SuggestionBehavior.cs
WalletWasabi.Gui/Behaviors/SuggestionBehavior.cs
@@ -36,6 +36,63 @@ namespace WalletWasabi.Gui.Behaviors
HandleAutoUpdate();
e.Handled = true;
}
+ if (e.Key == Avalonia.Input.Key.Down)
+ {
+ if (SuggestionItems != null)
+ {
+ if (SuggestionItems.All(x => !x.IsHighLighted))
+ {
+ var item = SuggestionItems.FirstOrDefault();
+ if (item != null)
+ {
+ item.IsHighLighted = true;
+ }
+ }
+ else
+ {
+ var index = SuggestionItems.Select((v, i) => new { sugg = v, index = i })?.FirstOrDefault(x => x.sugg.IsHighLighted)?.index;
+ if (index != null)
+ {
+ var suggItemsArray = SuggestionItems.ToArray();
+ suggItemsArray[index.Value].IsHighLighted = false;
+ index++;
+ if (suggItemsArray.Length <= index.Value)
+ {
+ index = 0;
+ }
+ suggItemsArray[index.Value].IsHighLighted = true;
+ }
+ }
+
+ e.Handled = true;
+ }
+ }
+ if (e.Key == Avalonia.Input.Key.Up)
+ {
+ if (SuggestionItems != null)
+ {
+ foreach (var item in SuggestionItems)
+ {
+ item.IsHighLighted = false;
+ }
+ e.Handled = true;
+ }
+ }
+ if (e.Key == Avalonia.Input.Key.Enter)
+ {
+ if (SuggestionItems != null)
+ {
+ foreach (var item in SuggestionItems)
+ {
+ if (item.IsHighLighted)
+ {
+ item.OnSelected();
+ break;
+ }
+ }
+ e.Handled = true;
+ }
+ }
}));
}

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/ReceiveTabView.xaml
WalletWasabi.Gui/Controls/WalletExplorer/ReceiveTabView.xaml
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
- <Button Focusable="False" Content="{Binding Word}" Command="{Binding OnSelected}" />
+ <Button Focusable="False" Content="{Binding Word}" Command="{Binding OnSelected}" IsPressed ="{Binding IsHighLighted}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>

MODIFY
WalletWasabi.Gui/Tabs/WalletManager/RecoverWalletView.xaml
WalletWasabi.Gui/Tabs/WalletManager/RecoverWalletView.xaml
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
- <Button Focusable="False" Content="{Binding Word}" Command="{Binding OnSelected}" />
+ <Button Focusable="False" Content="{Binding Word}" Command="{Binding OnSelected}" IsPressed ="{Binding IsHighLighted}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>

MODIFY
WalletWasabi.Gui/Tabs/WalletManager/SuggestionViewModel.cs
WalletWasabi.Gui/Tabs/WalletManager/SuggestionViewModel.cs
@@ -5,11 +5,13 @@ using System.Linq;
namespace WalletWasabi.Gui.Tabs.WalletManager
{
- public class SuggestionViewModel
+ public class SuggestionViewModel : ReactiveObject
{
public string Word { get; }
public Action<string> OnSelection { get; }
+ public bool _isHighLighted;
+
public SuggestionViewModel(string word, Action<string> onSeleted)
{
Word = word;
@@ -20,5 +22,11 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
{
OnSelection(Word);
}
+
+ public bool IsHighLighted
+ {
+ get { return _isHighLighted; }
+ set { this.RaiseAndSetIfChanged(ref _isHighLighted, value); }
+ }
}
}

Make labels selectable