mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-21 05:10:25 +08:00
enhance: auto-focus the first input element in popup (#2172)
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
@@ -182,6 +182,14 @@
|
||||
<Setter Property="FontSize" Value="{Binding Source={x:Static vm:Preferences.Instance}, Path=DefaultFontSize}"/>
|
||||
</Style>
|
||||
|
||||
<Style Selector="AdornerLayer">
|
||||
<Setter Property="DefaultFocusAdorner">
|
||||
<FocusAdornerTemplate>
|
||||
<Rectangle Margin="0" Stroke="{DynamicResource Brush.FG1}" StrokeDashArray="1,2" StrokeThickness="1"/>
|
||||
</FocusAdornerTemplate>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style Selector="ToolTip">
|
||||
<Setter Property="Foreground" Value="{DynamicResource Brush.FG1}"/>
|
||||
<Setter Property="Background" Value="{DynamicResource Brush.Popup}"/>
|
||||
@@ -1067,6 +1075,12 @@
|
||||
</Style>
|
||||
|
||||
<Style Selector="CheckBox">
|
||||
<Setter Property="FocusAdorner">
|
||||
<FocusAdornerTemplate>
|
||||
<Border/>
|
||||
</FocusAdornerTemplate>
|
||||
</Setter>
|
||||
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate>
|
||||
@@ -1085,7 +1099,14 @@
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
|
||||
|
||||
<Style Selector="^:focus-visible /template/ Border#Border">
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource Brush.Accent}"/>
|
||||
<Setter Property="Background" Value="{DynamicResource Brush.Accent}"/>
|
||||
</Style>
|
||||
<Style Selector="^:focus-visible /template/ Path#Icon">
|
||||
<Setter Property="Fill" Value="White"/>
|
||||
</Style>
|
||||
<Style Selector="^:pointerover /template/ Border#Border">
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource Brush.Accent}"/>
|
||||
</Style>
|
||||
@@ -1095,6 +1116,12 @@
|
||||
</Style>
|
||||
|
||||
<Style Selector="RadioButton">
|
||||
<Setter Property="FocusAdorner">
|
||||
<FocusAdornerTemplate>
|
||||
<Border/>
|
||||
</FocusAdornerTemplate>
|
||||
</Setter>
|
||||
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate>
|
||||
<Grid ColumnDefinitions="16,*" Background="Transparent">
|
||||
@@ -1136,9 +1163,26 @@
|
||||
<Style Selector="^:checked /template/ Ellipse#Dot">
|
||||
<Setter Property="Fill" Value="{DynamicResource Brush.Accent}"/>
|
||||
</Style>
|
||||
<Style Selector="^:focus-visible /template/ Ellipse#Border">
|
||||
<Setter Property="Stroke" Value="{DynamicResource Brush.Accent}"/>
|
||||
<Setter Property="Fill" Value="{DynamicResource Brush.Accent}"/>
|
||||
</Style>
|
||||
<Style Selector="^:focus-visible /template/ Ellipse#Dot">
|
||||
<Setter Property="Stroke" Value="White"/>
|
||||
<Setter Property="Fill" Value="White"/>
|
||||
</Style>
|
||||
<Style Selector="^:focus-visible:checked /template/ Ellipse#Dot">
|
||||
<Setter Property="Fill" Value="{DynamicResource Brush.Accent}"/>
|
||||
</Style>
|
||||
</Style>
|
||||
|
||||
<Style Selector="RadioButton.switch_button">
|
||||
<Setter Property="FocusAdorner">
|
||||
<FocusAdornerTemplate>
|
||||
<Rectangle Margin="0" Stroke="{DynamicResource Brush.FG1}" StrokeDashArray="1,2" StrokeThickness="1"/>
|
||||
</FocusAdornerTemplate>
|
||||
</Setter>
|
||||
|
||||
<Setter Property="Height" Value="24"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
|
||||
@@ -29,8 +29,7 @@
|
||||
VerticalAlignment="Center"
|
||||
CornerRadius="2"
|
||||
Watermark="{DynamicResource Text.Remote.Name.Placeholder}"
|
||||
Text="{Binding Name, Mode=TwoWay}"
|
||||
v:AutoFocusBehaviour.IsEnabled="True"/>
|
||||
Text="{Binding Name, Mode=TwoWay}"/>
|
||||
|
||||
<TextBlock Grid.Row="1" Grid.Column="0"
|
||||
HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:vm="using:SourceGit.ViewModels"
|
||||
xmlns:v="using:SourceGit.Views"
|
||||
mc:Ignorable="d" d:DesignWidth="500" d:DesignHeight="450"
|
||||
x:Class="SourceGit.Views.AddSubmodule"
|
||||
x:DataType="vm:AddSubmodule">
|
||||
@@ -28,8 +27,7 @@
|
||||
VerticalAlignment="Center"
|
||||
CornerRadius="2"
|
||||
Watermark="{DynamicResource Text.RepositoryURL}"
|
||||
Text="{Binding Url, Mode=TwoWay}"
|
||||
v:AutoFocusBehaviour.IsEnabled="True"/>
|
||||
Text="{Binding Url, Mode=TwoWay}"/>
|
||||
|
||||
<TextBlock Grid.Row="1" Grid.Column="0"
|
||||
HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:m="using:SourceGit.Models"
|
||||
xmlns:vm="using:SourceGit.ViewModels"
|
||||
xmlns:v="using:SourceGit.Views"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="SourceGit.Views.AddToIgnore"
|
||||
x:DataType="vm:AddToIgnore">
|
||||
@@ -27,8 +26,7 @@
|
||||
<TextBox Grid.Row="0" Grid.Column="1"
|
||||
Height="28"
|
||||
CornerRadius="3"
|
||||
Text="{Binding Pattern, Mode=TwoWay}"
|
||||
v:AutoFocusBehaviour.IsEnabled="True">
|
||||
Text="{Binding Pattern, Mode=TwoWay}">
|
||||
<TextBox.InnerLeftContent>
|
||||
<Path Width="12" Height="12" Margin="6,0,2,0" Data="{StaticResource Icons.Pattern}" Fill="{DynamicResource Brush.FG2}"/>
|
||||
</TextBox.InnerLeftContent>
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:m="using:SourceGit.Models"
|
||||
xmlns:vm="using:SourceGit.ViewModels"
|
||||
xmlns:v="using:SourceGit.Views"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="SourceGit.Views.Apply"
|
||||
x:DataType="vm:Apply">
|
||||
@@ -29,8 +28,7 @@
|
||||
Height="28"
|
||||
CornerRadius="3"
|
||||
Watermark="{DynamicResource Text.Apply.File.Placeholder}"
|
||||
Text="{Binding PatchFile, Mode=TwoWay}"
|
||||
v:AutoFocusBehaviour.IsEnabled="True">
|
||||
Text="{Binding PatchFile, Mode=TwoWay}">
|
||||
<TextBox.InnerRightContent>
|
||||
<Button Classes="icon_button" Width="30" Height="30" Click="SelectPatchFile">
|
||||
<Path Data="{StaticResource Icons.Folder.Open}" Fill="{DynamicResource Brush.FG1}"/>
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:m="using:SourceGit.Models"
|
||||
xmlns:vm="using:SourceGit.ViewModels"
|
||||
xmlns:v="using:SourceGit.Views"
|
||||
xmlns:c="using:SourceGit.Converters"
|
||||
mc:Ignorable="d" d:DesignWidth="500" d:DesignHeight="450"
|
||||
x:Class="SourceGit.Views.Archive"
|
||||
@@ -60,8 +59,7 @@
|
||||
Height="28"
|
||||
CornerRadius="3"
|
||||
Watermark="{DynamicResource Text.Archive.File.Placeholder}"
|
||||
Text="{Binding SaveFile, Mode=TwoWay}"
|
||||
v:AutoFocusBehaviour.IsEnabled="True">
|
||||
Text="{Binding SaveFile, Mode=TwoWay}">
|
||||
<TextBox.InnerRightContent>
|
||||
<Button Classes="icon_button" Width="30" Height="30" Click="SelectOutputFile">
|
||||
<Path Data="{StaticResource Icons.Folder.Open}" Fill="{DynamicResource Brush.FG1}"/>
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:vm="using:SourceGit.ViewModels"
|
||||
xmlns:v="using:SourceGit.Views"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="SourceGit.Views.Clone"
|
||||
x:DataType="vm:Clone">
|
||||
@@ -27,8 +26,7 @@
|
||||
<TextBox Grid.Row="0" Grid.Column="1"
|
||||
Height="28"
|
||||
CornerRadius="3"
|
||||
Text="{Binding Remote, Mode=TwoWay}"
|
||||
v:AutoFocusBehaviour.IsEnabled="True"/>
|
||||
Text="{Binding Remote, Mode=TwoWay}"/>
|
||||
|
||||
<TextBlock Grid.Row="1" Grid.Column="0"
|
||||
HorizontalAlignment="Right"
|
||||
|
||||
@@ -68,7 +68,8 @@
|
||||
<GridSplitter Grid.Column="1"
|
||||
MinWidth="1"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
|
||||
Background="Transparent"/>
|
||||
Background="Transparent"
|
||||
Focusable="False"/>
|
||||
|
||||
<Grid Grid.Column="2">
|
||||
<Border BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}">
|
||||
|
||||
@@ -159,7 +159,8 @@
|
||||
<GridSplitter Grid.Column="1"
|
||||
MinWidth="1"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
|
||||
Background="Transparent"/>
|
||||
Background="Transparent"
|
||||
Focusable="False"/>
|
||||
|
||||
<Grid Grid.Column="2">
|
||||
<Border BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}">
|
||||
|
||||
@@ -65,8 +65,7 @@
|
||||
VerticalAlignment="Center"
|
||||
CornerRadius="2"
|
||||
Text="{Binding Name, Mode=TwoWay}"
|
||||
Watermark="{DynamicResource Text.CreateBranch.Name.Placeholder}"
|
||||
v:AutoFocusBehaviour.IsEnabled="True"/>
|
||||
Watermark="{DynamicResource Text.CreateBranch.Name.Placeholder}"/>
|
||||
|
||||
<TextBlock Grid.Row="2" Grid.Column="0"
|
||||
HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:vm="using:SourceGit.ViewModels"
|
||||
xmlns:v="using:SourceGit.Views"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="SourceGit.Views.CreateGroup"
|
||||
x:DataType="vm:CreateGroup">
|
||||
@@ -20,7 +19,7 @@
|
||||
|
||||
<Grid Margin="8,16,0,0" Height="28" ColumnDefinitions="Auto,*">
|
||||
<TextBlock Grid.Column="0" HorizontalAlignment="Right" Margin="8,0" Text="{DynamicResource Text.Name}"/>
|
||||
<TextBox Grid.Column="1" CornerRadius="3" v:AutoFocusBehaviour.IsEnabled="True" Text="{Binding Name, Mode=TwoWay}"/>
|
||||
<TextBox Grid.Column="1" CornerRadius="3" Text="{Binding Name, Mode=TwoWay}"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
|
||||
@@ -53,8 +53,7 @@
|
||||
VerticalAlignment="Center"
|
||||
CornerRadius="2"
|
||||
Text="{Binding TagName, Mode=TwoWay}"
|
||||
Watermark="{DynamicResource Text.CreateTag.Name.Placeholder}"
|
||||
v:AutoFocusBehaviour.IsEnabled="True"/>
|
||||
Watermark="{DynamicResource Text.CreateTag.Name.Placeholder}"/>
|
||||
|
||||
<TextBlock Grid.Row="2" Grid.Column="0"
|
||||
HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||
|
||||
@@ -117,7 +117,8 @@
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
|
||||
Background="Transparent"
|
||||
BorderThickness="1,0,0,0"
|
||||
BorderBrush="{DynamicResource Brush.Border0}"/>
|
||||
BorderBrush="{DynamicResource Brush.Border0}"
|
||||
Focusable="False"/>
|
||||
|
||||
<!-- Commit Detail -->
|
||||
<Border Grid.Column="2" Padding="0,4" IsVisible="{Binding !IsLoading}">
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:vm="using:SourceGit.ViewModels"
|
||||
xmlns:v="using:SourceGit.Views"
|
||||
mc:Ignorable="d" d:DesignWidth="500" d:DesignHeight="450"
|
||||
x:Class="SourceGit.Views.EditRemote"
|
||||
x:DataType="vm:EditRemote">
|
||||
@@ -28,8 +27,7 @@
|
||||
VerticalAlignment="Center"
|
||||
CornerRadius="2"
|
||||
Watermark="{DynamicResource Text.Remote.Name.Placeholder}"
|
||||
Text="{Binding Name, Mode=TwoWay}"
|
||||
v:AutoFocusBehaviour.IsEnabled="True"/>
|
||||
Text="{Binding Name, Mode=TwoWay}"/>
|
||||
|
||||
<TextBlock Grid.Row="1" Grid.Column="0"
|
||||
HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:c="using:SourceGit.Converters"
|
||||
xmlns:vm="using:SourceGit.ViewModels"
|
||||
xmlns:v="using:SourceGit.Views"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="SourceGit.Views.EditRepositoryNode"
|
||||
x:DataType="vm:EditRepositoryNode">
|
||||
@@ -32,7 +31,7 @@
|
||||
</Grid>
|
||||
<Grid Height="28" Margin="8,4,0,0" ColumnDefinitions="120,*">
|
||||
<TextBlock Grid.Column="0" HorizontalAlignment="Right" Margin="0,0,8,0" Text="{DynamicResource Text.EditRepositoryNode.Name}"/>
|
||||
<TextBox Grid.Column="1" CornerRadius="3" Text="{Binding Name, Mode=TwoWay}" v:AutoFocusBehaviour.IsEnabled="True"/>
|
||||
<TextBox Grid.Column="1" CornerRadius="3" Text="{Binding Name, Mode=TwoWay}"/>
|
||||
</Grid>
|
||||
<Grid Height="28" Margin="8,4,0,0" ColumnDefinitions="120,*" IsVisible="{Binding IsRepository}">
|
||||
<TextBlock Grid.Column="0" HorizontalAlignment="Right" Margin="0,0,8,0" Text="{DynamicResource Text.EditRepositoryNode.Bookmark}"/>
|
||||
|
||||
@@ -7,8 +7,7 @@
|
||||
xmlns:c="using:SourceGit.Converters"
|
||||
mc:Ignorable="d" d:DesignWidth="500" d:DesignHeight="450"
|
||||
x:Class="SourceGit.Views.ExecuteCustomAction"
|
||||
x:DataType="vm:ExecuteCustomAction"
|
||||
Loaded="OnLoaded">
|
||||
x:DataType="vm:ExecuteCustomAction">
|
||||
<StackPanel Orientation="Vertical" Margin="8,0">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Path Width="16" Height="16"
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
using System;
|
||||
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Platform.Storage;
|
||||
using Avalonia.VisualTree;
|
||||
|
||||
namespace SourceGit.Views
|
||||
{
|
||||
@@ -15,19 +13,6 @@ namespace SourceGit.Views
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void OnLoaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var inputs = this.GetVisualDescendants();
|
||||
foreach (var input in inputs)
|
||||
{
|
||||
if (input is InputElement { Focusable: true, IsTabStop: true } focusable)
|
||||
{
|
||||
focusable.Focus();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async void SelectPath(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var topLevel = TopLevel.GetTopLevel(this);
|
||||
|
||||
@@ -110,7 +110,8 @@
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
|
||||
Background="Transparent"
|
||||
BorderThickness="1,0,0,0"
|
||||
BorderBrush="{DynamicResource Brush.Border0}"/>
|
||||
BorderBrush="{DynamicResource Brush.Border0}"
|
||||
Focusable="False"/>
|
||||
|
||||
<ContentControl Grid.Column="2" Content="{Binding ViewContent}">
|
||||
<ContentControl.DataTemplates>
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:m="using:SourceGit.Models"
|
||||
xmlns:vm="using:SourceGit.ViewModels"
|
||||
xmlns:v="using:SourceGit.Views"
|
||||
mc:Ignorable="d" d:DesignWidth="500" d:DesignHeight="450"
|
||||
x:Class="SourceGit.Views.GitFlowStart"
|
||||
x:DataType="vm:GitFlowStart">
|
||||
@@ -38,8 +37,7 @@
|
||||
VerticalAlignment="Center"
|
||||
CornerRadius="2"
|
||||
Watermark="{DynamicResource Text.GitFlow.StartPlaceholder}"
|
||||
Text="{Binding Name, Mode=TwoWay}"
|
||||
v:AutoFocusBehaviour.IsEnabled="True"/>
|
||||
Text="{Binding Name, Mode=TwoWay}"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
|
||||
@@ -277,7 +277,8 @@
|
||||
MinWidth="1" MinHeight="1"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
|
||||
Background="{DynamicResource Brush.Window}"
|
||||
BorderBrush="{DynamicResource Brush.Border0}"/>
|
||||
BorderBrush="{DynamicResource Brush.Border0}"
|
||||
Focusable="False"/>
|
||||
|
||||
<Grid Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3">
|
||||
<Grid IsVisible="{Binding DetailContext, Converter={x:Static ObjectConverters.IsNull}}">
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:vm="using:SourceGit.ViewModels"
|
||||
xmlns:v="using:SourceGit.Views"
|
||||
mc:Ignorable="d" d:DesignWidth="500" d:DesignHeight="450"
|
||||
x:Class="SourceGit.Views.InitGitFlow"
|
||||
x:DataType="vm:InitGitFlow">
|
||||
@@ -27,8 +26,7 @@
|
||||
Height="26"
|
||||
VerticalAlignment="Center"
|
||||
CornerRadius="2"
|
||||
Text="{Binding Master, Mode=TwoWay}"
|
||||
v:AutoFocusBehaviour.IsEnabled="True"/>
|
||||
Text="{Binding Master, Mode=TwoWay}"/>
|
||||
|
||||
<TextBlock Grid.Row="1" Grid.Column="0"
|
||||
HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||
|
||||
@@ -207,7 +207,8 @@
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
|
||||
Background="Transparent"
|
||||
BorderThickness="0,1,0,0"
|
||||
BorderBrush="{DynamicResource Brush.Border2}"/>
|
||||
BorderBrush="{DynamicResource Brush.Border2}"
|
||||
Focusable="False"/>
|
||||
|
||||
<ContentControl Grid.Row="2">
|
||||
<ContentControl.Content>
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:vm="using:SourceGit.ViewModels"
|
||||
xmlns:v="using:SourceGit.Views"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="SourceGit.Views.LFSTrackCustomPattern"
|
||||
x:DataType="vm:LFSTrackCustomPattern">
|
||||
@@ -26,8 +25,7 @@
|
||||
<TextBox Grid.Row="0" Grid.Column="1"
|
||||
Height="28"
|
||||
CornerRadius="3"
|
||||
Text="{Binding Pattern, Mode=TwoWay}"
|
||||
v:AutoFocusBehaviour.IsEnabled="True"/>
|
||||
Text="{Binding Pattern, Mode=TwoWay}"/>
|
||||
|
||||
<CheckBox Grid.Row="1" Grid.Column="1"
|
||||
Content="{DynamicResource Text.GitLFS.AddTrackPattern.IsFilename}"
|
||||
|
||||
@@ -86,7 +86,8 @@
|
||||
IsVisible="{Binding InProgress, Converter={x:Static BoolConverters.Not}}">
|
||||
<Button Width="0" Height="0"
|
||||
Click="OnPopupSureByHotKey"
|
||||
HotKey="Enter"/>
|
||||
HotKey="Enter"
|
||||
Focusable="False"/>
|
||||
<Button Classes="flat primary"
|
||||
Width="100" Height="28"
|
||||
Padding="0"
|
||||
|
||||
@@ -1,11 +1,43 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Templates;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.VisualTree;
|
||||
|
||||
namespace SourceGit.Views
|
||||
{
|
||||
public class PopupDataTemplates : IDataTemplate
|
||||
{
|
||||
public Control Build(object param) => App.CreateViewForViewModel(param);
|
||||
public bool Match(object data) => data is ViewModels.Popup;
|
||||
public bool Match(object data)
|
||||
{
|
||||
return data is ViewModels.Popup;
|
||||
}
|
||||
|
||||
public Control Build(object param)
|
||||
{
|
||||
var control = App.CreateViewForViewModel(param);
|
||||
|
||||
control.Loaded += (o, e) =>
|
||||
{
|
||||
if (o is not Control ctl)
|
||||
return;
|
||||
|
||||
var inputs = ctl.GetVisualDescendants();
|
||||
foreach (var input in inputs)
|
||||
{
|
||||
if (input is SelectableTextBlock)
|
||||
continue;
|
||||
|
||||
if (input is InputElement { Focusable: true, IsEffectivelyEnabled: true } focusable)
|
||||
{
|
||||
focusable.Focus(NavigationMethod.Directional);
|
||||
if (input is TextBox box)
|
||||
box.CaretIndex = box.CaretIndex = box.Text?.Length ?? 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return control;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,8 +37,7 @@
|
||||
VerticalAlignment="Center"
|
||||
CornerRadius="2"
|
||||
Text="{Binding Name, Mode=TwoWay}"
|
||||
Watermark="{DynamicResource Text.RenameBranch.Name.Placeholder}"
|
||||
v:AutoFocusBehaviour.IsEnabled="True"/>
|
||||
Watermark="{DynamicResource Text.RenameBranch.Name.Placeholder}"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
|
||||
@@ -693,7 +693,8 @@
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
|
||||
Background="Transparent"
|
||||
BorderThickness="0,0,1,0"
|
||||
BorderBrush="{DynamicResource Brush.Border0}"/>
|
||||
BorderBrush="{DynamicResource Brush.Border0}"
|
||||
Focusable="False"/>
|
||||
|
||||
<!-- Right -->
|
||||
<Grid Grid.Column="2" RowDefinitions="Auto,Auto,Auto,*">
|
||||
|
||||
@@ -125,7 +125,8 @@
|
||||
<GridSplitter Grid.Column="1"
|
||||
MinWidth="1"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
|
||||
Background="Transparent"/>
|
||||
Background="Transparent"
|
||||
Focusable="False"/>
|
||||
|
||||
<Grid Grid.Column="2">
|
||||
<Border BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}">
|
||||
|
||||
@@ -109,7 +109,8 @@
|
||||
<GridSplitter Grid.Column="1"
|
||||
MinWidth="1"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
|
||||
Background="Transparent"/>
|
||||
Background="Transparent"
|
||||
Focusable="False"/>
|
||||
|
||||
<!-- Right: File Content Viewer -->
|
||||
<Grid Grid.Column="2">
|
||||
|
||||
@@ -54,7 +54,6 @@
|
||||
AcceptsTab="True"
|
||||
VerticalContentAlignment="Top"
|
||||
Padding="4"
|
||||
v:AutoFocusBehaviour.IsEnabled="True"
|
||||
Tag="{Binding Source={x:Static v:StealHotKey.Enter}}"/>
|
||||
|
||||
<CheckBox Grid.Row="2" Grid.Column="1"
|
||||
|
||||
@@ -141,7 +141,8 @@
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
|
||||
Background="Transparent"
|
||||
BorderThickness="1,0,0,0"
|
||||
BorderBrush="{DynamicResource Brush.Border0}"/>
|
||||
BorderBrush="{DynamicResource Brush.Border0}"
|
||||
Focusable="False"/>
|
||||
|
||||
<!-- Right -->
|
||||
<Grid Grid.Column="2" Margin="0,4,4,4">
|
||||
|
||||
@@ -118,7 +118,8 @@
|
||||
MinWidth="1"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"/>
|
||||
BorderThickness="0"
|
||||
Focusable="False"/>
|
||||
|
||||
<Border Grid.Column="2"
|
||||
BorderBrush="{DynamicResource Brush.Border2}"
|
||||
|
||||
@@ -141,7 +141,8 @@
|
||||
<GridSplitter Grid.Row="2"
|
||||
MinHeight="1"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
|
||||
Background="{DynamicResource Brush.Border0}"/>
|
||||
Background="{DynamicResource Brush.Border0}"
|
||||
Focusable="False"/>
|
||||
|
||||
<!-- Staged -->
|
||||
<Grid Grid.Row="3" RowDefinitions="28,*">
|
||||
@@ -197,7 +198,8 @@
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
|
||||
Background="Transparent"
|
||||
BorderThickness="1,0,0,0"
|
||||
BorderBrush="{DynamicResource Brush.Border0}"/>
|
||||
BorderBrush="{DynamicResource Brush.Border0}"
|
||||
Focusable="False"/>
|
||||
|
||||
<!-- Right -->
|
||||
<Grid Grid.Column="2" Margin="0,4,4,4">
|
||||
@@ -237,7 +239,8 @@
|
||||
<!-- Splitter -->
|
||||
<GridSplitter Grid.Row="1" MinHeight="1"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
|
||||
Background="Transparent"/>
|
||||
Background="Transparent"
|
||||
Focusable="False"/>
|
||||
|
||||
<!-- Commit Message -->
|
||||
<v:CommitMessageToolBox Grid.Row="2" ShowAdvancedOptions="True" CommitMessage="{Binding CommitMessage, Mode=TwoWay}"/>
|
||||
|
||||
Reference in New Issue
Block a user