fix: fix navigation issue for messagebox and drawer.
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate TargetType="u:CustomDrawerControl">
|
||||
<Border Name="PART_Root"
|
||||
Focusable="True"
|
||||
Margin="{TemplateBinding Padding, Converter={x:Static c:ThicknessTakeConverter.Left}}"
|
||||
Padding="0"
|
||||
HorizontalAlignment="Stretch"
|
||||
@@ -77,6 +78,7 @@
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate TargetType="u:DefaultDrawerControl">
|
||||
<Border Name="PART_Root"
|
||||
Focusable="True"
|
||||
Margin="{TemplateBinding Padding, Converter={x:Static c:ThicknessTakeConverter.Left}}"
|
||||
Padding="0"
|
||||
HorizontalAlignment="Stretch"
|
||||
|
||||
@@ -33,9 +33,9 @@
|
||||
<Border Name="PART_TransparencyFallback" IsHitTestVisible="False" />
|
||||
<Border Background="{TemplateBinding Background}" IsHitTestVisible="False" />
|
||||
<Panel Margin="{TemplateBinding WindowDecorationMargin}" Background="Transparent" />
|
||||
<ChromeOverlayLayer />
|
||||
<Grid RowDefinitions="Auto, *, Auto">
|
||||
<Grid
|
||||
<VisualLayerManager>
|
||||
<Grid RowDefinitions="Auto, *, Auto">
|
||||
<Grid
|
||||
Grid.Row="0"
|
||||
Margin="24,24,24,0"
|
||||
ColumnDefinitions="Auto, *, Auto">
|
||||
@@ -61,7 +61,7 @@
|
||||
Grid.Column="2"
|
||||
Theme="{DynamicResource CloseButton}" />
|
||||
</Grid>
|
||||
<Grid
|
||||
<Grid
|
||||
Grid.Row="1"
|
||||
MaxWidth="{DynamicResource MessageBoxWindowContentMaxWidth}"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
@@ -79,7 +79,7 @@
|
||||
TextWrapping="Wrap" />
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
<StackPanel
|
||||
<StackPanel
|
||||
Grid.Row="2"
|
||||
Margin="24,0,24,24"
|
||||
HorizontalAlignment="Right"
|
||||
@@ -109,6 +109,7 @@
|
||||
Theme="{DynamicResource SolidButton}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</VisualLayerManager>
|
||||
</Panel>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
@@ -155,6 +156,7 @@
|
||||
<ControlTemplate TargetType="u:MessageBoxControl">
|
||||
<Border
|
||||
Padding="0"
|
||||
Focusable="True"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Classes="Shadow"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Ursa.Common;
|
||||
using Ursa.Controls.Options;
|
||||
|
||||
@@ -60,7 +61,8 @@ public static class Drawer
|
||||
var drawer = new DefaultDrawerControl
|
||||
{
|
||||
Content = new TView(),
|
||||
DataContext = vm
|
||||
DataContext = vm,
|
||||
[KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Cycle
|
||||
};
|
||||
ConfigureDefaultDrawer(drawer, options);
|
||||
host.AddModalDrawer(drawer);
|
||||
@@ -75,7 +77,8 @@ public static class Drawer
|
||||
var drawer = new DefaultDrawerControl
|
||||
{
|
||||
Content = control,
|
||||
DataContext = vm
|
||||
DataContext = vm,
|
||||
[KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Cycle
|
||||
};
|
||||
ConfigureDefaultDrawer(drawer, options);
|
||||
host.AddModalDrawer(drawer);
|
||||
@@ -92,7 +95,8 @@ public static class Drawer
|
||||
var drawer = new DefaultDrawerControl
|
||||
{
|
||||
Content = view,
|
||||
DataContext = vm
|
||||
DataContext = vm,
|
||||
[KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Cycle
|
||||
};
|
||||
ConfigureDefaultDrawer(drawer, options);
|
||||
host.AddModalDrawer(drawer);
|
||||
@@ -152,7 +156,8 @@ public static class Drawer
|
||||
var dialog = new CustomDrawerControl
|
||||
{
|
||||
Content = new TView(),
|
||||
DataContext = vm
|
||||
DataContext = vm,
|
||||
[KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Cycle
|
||||
};
|
||||
ConfigureCustomDrawer(dialog, options);
|
||||
host.AddModalDrawer(dialog);
|
||||
@@ -167,7 +172,8 @@ public static class Drawer
|
||||
var dialog = new CustomDrawerControl
|
||||
{
|
||||
Content = control,
|
||||
DataContext = vm
|
||||
DataContext = vm,
|
||||
[KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Cycle
|
||||
};
|
||||
ConfigureCustomDrawer(dialog, options);
|
||||
host.AddModalDrawer(dialog);
|
||||
@@ -185,7 +191,8 @@ public static class Drawer
|
||||
var dialog = new CustomDrawerControl
|
||||
{
|
||||
Content = view,
|
||||
DataContext = vm
|
||||
DataContext = vm,
|
||||
[KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Cycle
|
||||
};
|
||||
ConfigureCustomDrawer(dialog, options);
|
||||
host.AddModalDrawer(dialog);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.Input;
|
||||
|
||||
namespace Ursa.Controls;
|
||||
|
||||
@@ -63,7 +64,8 @@ public static class MessageBox
|
||||
Content = message,
|
||||
Title = title,
|
||||
Buttons = button,
|
||||
MessageIcon = icon
|
||||
MessageIcon = icon,
|
||||
[KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Cycle
|
||||
};
|
||||
host.AddModalDialog(messageControl);
|
||||
var result = await messageControl.ShowAsync<MessageBoxResult>();
|
||||
|
||||
@@ -2,7 +2,9 @@ using Avalonia;
|
||||
using Avalonia.Animation;
|
||||
using Avalonia.Animation.Easings;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Styling;
|
||||
using Avalonia.VisualTree;
|
||||
using Irihi.Avalonia.Shared.Shapes;
|
||||
using Ursa.Common;
|
||||
using Ursa.Controls.OverlayShared;
|
||||
@@ -67,8 +69,8 @@ public partial class OverlayDialogHost
|
||||
{
|
||||
await Task.WhenAll(animation.RunAsync(control), _maskAppearAnimation.RunAsync(mask));
|
||||
}
|
||||
|
||||
control.Focus();
|
||||
var element = control.GetVisualDescendants().OfType<InputElement>().FirstOrDefault(a => a.Focusable);
|
||||
element?.Focus();
|
||||
}
|
||||
|
||||
private void SetDrawerPosition(DrawerControlBase control)
|
||||
|
||||
Reference in New Issue
Block a user