feat: try to focus on dialog and make tab navigation cycled.
This commit is contained in:
@@ -19,6 +19,7 @@
|
|||||||
<ControlTemplate TargetType="u:CustomDialogControl">
|
<ControlTemplate TargetType="u:CustomDialogControl">
|
||||||
<Border
|
<Border
|
||||||
Name="PART_Border"
|
Name="PART_Border"
|
||||||
|
Focusable="True"
|
||||||
Padding="0"
|
Padding="0"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
@@ -152,6 +153,7 @@
|
|||||||
<Border
|
<Border
|
||||||
Name="PART_Border"
|
Name="PART_Border"
|
||||||
Padding="0"
|
Padding="0"
|
||||||
|
Focusable="True"
|
||||||
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
|
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
|
||||||
VerticalAlignment="{TemplateBinding VerticalAlignment}"
|
VerticalAlignment="{TemplateBinding VerticalAlignment}"
|
||||||
BoxShadow="0 0 8 0 #1A000000"
|
BoxShadow="0 0 8 0 #1A000000"
|
||||||
|
|||||||
@@ -65,7 +65,9 @@
|
|||||||
Margin="{Binding $parent[u:UrsaWindow].TitleBarMargin}"
|
Margin="{Binding $parent[u:UrsaWindow].TitleBarMargin}"
|
||||||
LeftContent="{Binding $parent[u:UrsaWindow].LeftContent}"
|
LeftContent="{Binding $parent[u:UrsaWindow].LeftContent}"
|
||||||
RightContent="{Binding $parent[u:UrsaWindow].RightContent}" />
|
RightContent="{Binding $parent[u:UrsaWindow].RightContent}" />
|
||||||
<u:OverlayDialogHost IsModalStatusReporter="True" />
|
<VisualLayerManager>
|
||||||
|
<u:OverlayDialogHost IsModalStatusReporter="True" />
|
||||||
|
</VisualLayerManager>
|
||||||
</VisualLayerManager.ChromeOverlayLayer>
|
</VisualLayerManager.ChromeOverlayLayer>
|
||||||
<Panel>
|
<Panel>
|
||||||
<ContentPresenter
|
<ContentPresenter
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Input;
|
||||||
using Avalonia.Layout;
|
using Avalonia.Layout;
|
||||||
|
|
||||||
namespace Ursa.Controls;
|
namespace Ursa.Controls;
|
||||||
@@ -93,6 +94,7 @@ public static class OverlayDialog
|
|||||||
{
|
{
|
||||||
Content = view,
|
Content = view,
|
||||||
DataContext = vm,
|
DataContext = vm,
|
||||||
|
[KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Cycle
|
||||||
};
|
};
|
||||||
ConfigureCustomDialogControl(t, options);
|
ConfigureCustomDialogControl(t, options);
|
||||||
host.AddDialog(t);
|
host.AddDialog(t);
|
||||||
@@ -108,6 +110,7 @@ public static class OverlayDialog
|
|||||||
{
|
{
|
||||||
Content = new TView(),
|
Content = new TView(),
|
||||||
DataContext = vm,
|
DataContext = vm,
|
||||||
|
[KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Cycle
|
||||||
};
|
};
|
||||||
ConfigureDefaultDialogControl(t, options);
|
ConfigureDefaultDialogControl(t, options);
|
||||||
host.AddModalDialog(t);
|
host.AddModalDialog(t);
|
||||||
@@ -123,6 +126,7 @@ public static class OverlayDialog
|
|||||||
{
|
{
|
||||||
Content = control,
|
Content = control,
|
||||||
DataContext = vm,
|
DataContext = vm,
|
||||||
|
[KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Cycle
|
||||||
};
|
};
|
||||||
ConfigureDefaultDialogControl(t, options);
|
ConfigureDefaultDialogControl(t, options);
|
||||||
host.AddModalDialog(t);
|
host.AddModalDialog(t);
|
||||||
@@ -139,6 +143,7 @@ public static class OverlayDialog
|
|||||||
{
|
{
|
||||||
Content = new TView(),
|
Content = new TView(),
|
||||||
DataContext = vm,
|
DataContext = vm,
|
||||||
|
[KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Cycle
|
||||||
};
|
};
|
||||||
ConfigureCustomDialogControl(t, options);
|
ConfigureCustomDialogControl(t, options);
|
||||||
host.AddModalDialog(t);
|
host.AddModalDialog(t);
|
||||||
@@ -154,6 +159,7 @@ public static class OverlayDialog
|
|||||||
{
|
{
|
||||||
Content = control,
|
Content = control,
|
||||||
DataContext = vm,
|
DataContext = vm,
|
||||||
|
[KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Cycle
|
||||||
};
|
};
|
||||||
ConfigureCustomDialogControl(t, options);
|
ConfigureCustomDialogControl(t, options);
|
||||||
host.AddModalDialog(t);
|
host.AddModalDialog(t);
|
||||||
@@ -172,6 +178,7 @@ public static class OverlayDialog
|
|||||||
{
|
{
|
||||||
Content = view,
|
Content = view,
|
||||||
DataContext = vm,
|
DataContext = vm,
|
||||||
|
[KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Cycle
|
||||||
};
|
};
|
||||||
ConfigureCustomDialogControl(t, options);
|
ConfigureCustomDialogControl(t, options);
|
||||||
host.AddModalDialog(t);
|
host.AddModalDialog(t);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Input;
|
using Avalonia.Input;
|
||||||
|
using Avalonia.VisualTree;
|
||||||
using Irihi.Avalonia.Shared.Helpers;
|
using Irihi.Avalonia.Shared.Helpers;
|
||||||
using Irihi.Avalonia.Shared.Shapes;
|
using Irihi.Avalonia.Shared.Shapes;
|
||||||
using Ursa.Controls.OverlayShared;
|
using Ursa.Controls.OverlayShared;
|
||||||
@@ -170,6 +171,9 @@ public partial class OverlayDialogHost
|
|||||||
{
|
{
|
||||||
_maskAppearAnimation.RunAsync(mask);
|
_maskAppearAnimation.RunAsync(mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var element = control.GetVisualDescendants().OfType<InputElement>().FirstOrDefault(a => a.Focusable);
|
||||||
|
element?.Focus();
|
||||||
_modalCount++;
|
_modalCount++;
|
||||||
IsInModalStatus = _modalCount > 0;
|
IsInModalStatus = _modalCount > 0;
|
||||||
control.IsClosed = false;
|
control.IsClosed = false;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public abstract class OverlayFeedbackElement: ContentControl
|
|||||||
|
|
||||||
static OverlayFeedbackElement()
|
static OverlayFeedbackElement()
|
||||||
{
|
{
|
||||||
FocusableProperty.OverrideDefaultValue<OverlayFeedbackElement>(true);
|
FocusableProperty.OverrideDefaultValue<OverlayFeedbackElement>(false);
|
||||||
DataContextProperty.Changed.AddClassHandler<OverlayFeedbackElement, object?>((o, e) => o.OnDataContextChange(e));
|
DataContextProperty.Changed.AddClassHandler<OverlayFeedbackElement, object?>((o, e) => o.OnDataContextChange(e));
|
||||||
ClosedEvent.AddClassHandler<OverlayFeedbackElement>((o,e)=>o.OnClosed(e));
|
ClosedEvent.AddClassHandler<OverlayFeedbackElement>((o,e)=>o.OnClosed(e));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user