diff --git a/src/Views/ExecuteCustomAction.axaml b/src/Views/ExecuteCustomAction.axaml index 8da74492..fd2a9c65 100644 --- a/src/Views/ExecuteCustomAction.axaml +++ b/src/Views/ExecuteCustomAction.axaml @@ -7,7 +7,8 @@ xmlns:c="using:SourceGit.Converters" mc:Ignorable="d" d:DesignWidth="500" d:DesignHeight="450" x:Class="SourceGit.Views.ExecuteCustomAction" - x:DataType="vm:ExecuteCustomAction"> + x:DataType="vm:ExecuteCustomAction" + Loaded="OnLoaded"> - + - + @@ -53,34 +54,27 @@ - - - - - + - + - - - + + + - - - - + + diff --git a/src/Views/ExecuteCustomAction.axaml.cs b/src/Views/ExecuteCustomAction.axaml.cs index 94d1f7c8..1a077469 100644 --- a/src/Views/ExecuteCustomAction.axaml.cs +++ b/src/Views/ExecuteCustomAction.axaml.cs @@ -1,8 +1,10 @@ using System; - +using System.Linq; using Avalonia.Controls; +using Avalonia.Input; using Avalonia.Interactivity; using Avalonia.Platform.Storage; +using Avalonia.VisualTree; namespace SourceGit.Views { @@ -13,6 +15,15 @@ namespace SourceGit.Views InitializeComponent(); } + private void OnLoaded(object sender, RoutedEventArgs e) + { + var firstFocusable = this + .GetVisualDescendants() + .OfType() + .FirstOrDefault(x => x.Focusable && x.IsTabStop); + firstFocusable?.Focus(); + } + private async void SelectPath(object sender, RoutedEventArgs e) { var topLevel = TopLevel.GetTopLevel(this);