Skip to content

Commit

Permalink
github: add double-click to select behaviour to select account
Browse files Browse the repository at this point in the history
Add the ability to double-click to select an account and 'continue' for
the account selection Avalonia window.
  • Loading branch information
mjcheetham committed May 31, 2023
1 parent 28b2091 commit b94ade0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/shared/GitHub/UI/Views/SelectAccountView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
Margin="20,0,20,10"
MaxHeight="200"
Background="Transparent"
AutoScrollToSelectedItem="True">
AutoScrollToSelectedItem="True"
DoubleTapped="ListBox_OnDoubleTapped">
<ListBox.ItemTemplate>
<DataTemplate DataType="vm:AccountViewModel">
<DockPanel LastChildFill="True">
Expand Down
10 changes: 10 additions & 0 deletions src/shared/GitHub/UI/Views/SelectAccountView.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Markup.Xaml;
using GitHub.UI.ViewModels;

namespace GitHub.UI.Views;

Expand All @@ -15,4 +17,12 @@ private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}

private void ListBox_OnDoubleTapped(object sender, TappedEventArgs e)
{
if (DataContext is SelectAccountViewModel { SelectedAccount: not null } vm)
{
vm.ContinueCommand.Execute(null);
}
}
}

0 comments on commit b94ade0

Please sign in to comment.