close the error dialog by pressing Enter/Esc

This commit is contained in:
2026-05-03 18:31:07 +03:00
parent 5a7dfc7f9a
commit 72997f832e
2 changed files with 20 additions and 9 deletions

View File

@@ -32,13 +32,16 @@
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>
<!-- Action Button --> <!-- Action Button -->
<Button Grid.Row="1" <Button Grid.Row="1"
Content="Got it" x:Name="OkButton"
Click="Ok_Click" Content="Got it"
HorizontalAlignment="Right" Click="Ok_Click"
Padding="25,8" IsDefault="True"
BorderThickness="0" IsCancel="True"
HorizontalAlignment="Right"
Padding="25,8"
BorderThickness="0"
CornerRadius="4" CornerRadius="4"
Cursor="Hand"> Cursor="Hand">
<Button.Styles> <Button.Styles>

View File

@@ -1,5 +1,7 @@
using Avalonia.Controls; using System;
using Avalonia.Controls;
using Avalonia.Interactivity; using Avalonia.Interactivity;
using Avalonia.Threading;
namespace KeyKeeper.Views; namespace KeyKeeper.Views;
@@ -16,4 +18,10 @@ public partial class ErrorDialog : Window
{ {
Close(); Close();
} }
}
protected override void OnOpened(EventArgs e)
{
base.OnOpened(e);
OkButton.Focus();
}
}