Files
2dust_v2rayN/v2rayN/v2rayN.Desktop/Views/BackupAndRestoreView.axaml
T
Miheichev Aleksandr Sergeevich fa9d4a4769 fix(ui): line up the backup dialog columns again (#10302)
#10292 made the label and button columns of the backup view Auto with
a minimum width, so that longer labels and buttons fit. Each of the two
cards sizes its own grid, so when the remote (WebDAV) buttons are wider
than the local ones, the local buttons no longer sit under the remote
ones and the separators of the two cards differ in length. This shows
in English and in every other language except Chinese.

Share the column widths of the two cards with SharedSizeGroup: both
cards line up again, and the long labels and buttons still fit. In
Avalonia the buttons stay centred in the shared column; in WPF they
fill it as before, so the local buttons get as wide as the remote ones.
2026-10-07 11:09:32 +08:00

228 lines
11 KiB
XML

<UserControl
x:Class="v2rayN.Desktop.Views.BackupAndRestoreView"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:dd="clr-namespace:v2rayN.Desktop.DesignData"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib"
d:DesignHeight="450"
d:DesignWidth="800"
Design.DataContext="{x:Static dd:DesignData.BackupAndRestore}"
mc:Ignorable="d">
<UserControl.Styles>
<Style Selector="Button">
<Setter Property="MinWidth" Value="180" />
</Style>
</UserControl.Styles>
<DockPanel Margin="{StaticResource Margin8}">
<StackPanel Margin="{StaticResource Margin4}" DockPanel.Dock="Bottom">
<TextBlock
Name="txtMsg"
Margin="{StaticResource Margin4}"
HorizontalAlignment="Left" />
</StackPanel>
<StackPanel Grid.IsSharedSizeScope="True">
<Border
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Theme="{DynamicResource CardBorder}">
<Grid Margin="{StaticResource Margin4}" RowDefinitions="Auto,Auto,Auto,Auto">
<Grid.ColumnDefinitions>
<ColumnDefinition
Width="Auto"
MinWidth="300"
SharedSizeGroup="BackupLabel" />
<ColumnDefinition
Width="Auto"
MinWidth="200"
SharedSizeGroup="BackupButton" />
</Grid.ColumnDefinitions>
<TextBlock
Grid.Row="0"
Grid.Column="0"
Margin="{StaticResource Margin4}"
Text="{x:Static resx:ResUI.menuLocalBackupAndRestore}" />
<TextBlock
Grid.Row="1"
Grid.Column="0"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Text="{x:Static resx:ResUI.menuLocalBackup}" />
<Button
Name="menuLocalBackup"
Grid.Row="1"
Grid.Column="1"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Content="{x:Static resx:ResUI.menuLocalBackup}" />
<Separator
Grid.Row="2"
Grid.Column="0"
Grid.ColumnSpan="2"
Margin="{StaticResource MarginTb8}" />
<TextBlock
Grid.Row="3"
Grid.Column="0"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Text="{x:Static resx:ResUI.menuLocalRestore}" />
<Button
Name="menuLocalRestore"
Grid.Row="3"
Grid.Column="1"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Content="{x:Static resx:ResUI.menuLocalRestore}" />
</Grid>
</Border>
<Border
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Theme="{DynamicResource CardBorder}">
<Grid Margin="{StaticResource Margin4}" RowDefinitions="Auto,Auto,Auto,Auto,Auto">
<Grid.ColumnDefinitions>
<ColumnDefinition
Width="Auto"
MinWidth="300"
SharedSizeGroup="BackupLabel" />
<ColumnDefinition
Width="Auto"
MinWidth="200"
SharedSizeGroup="BackupButton" />
</Grid.ColumnDefinitions>
<StackPanel
Grid.Row="0"
Grid.Column="0"
Orientation="Horizontal">
<TextBlock Margin="{StaticResource Margin4}" Text="{x:Static resx:ResUI.menuRemoteBackupAndRestore}" />
<Button Margin="{StaticResource MarginLr8}" Classes="IconButton">
<Button.Content>
<PathIcon Data="{StaticResource SemiIconMore}">
<PathIcon.RenderTransform>
<RotateTransform Angle="90" />
</PathIcon.RenderTransform>
</PathIcon>
</Button.Content>
<Button.Flyout>
<Flyout>
<StackPanel>
<Grid ColumnDefinitions="Auto,300" RowDefinitions="Auto,Auto,Auto,Auto,Auto">
<TextBlock
Grid.Row="0"
Grid.Column="0"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Text="{x:Static resx:ResUI.LvWebDavUrl}" />
<TextBox
x:Name="txtWebDavUrl"
Grid.Row="0"
Grid.Column="1"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
TextWrapping="Wrap" />
<TextBlock
Grid.Row="1"
Grid.Column="0"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Text="{x:Static resx:ResUI.LvWebDavUserName}" />
<TextBox
x:Name="txtWebDavUserName"
Grid.Row="1"
Grid.Column="1"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center" />
<TextBlock
Grid.Row="2"
Grid.Column="0"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Text="{x:Static resx:ResUI.LvWebDavPassword}" />
<TextBox
x:Name="txtWebDavPassword"
Grid.Row="2"
Grid.Column="1"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center" />
<TextBlock
Grid.Row="3"
Grid.Column="0"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Text="{x:Static resx:ResUI.LvWebDavDirName}" />
<TextBox
x:Name="txtWebDavDirName"
Grid.Row="3"
Grid.Column="1"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center" />
<Button
x:Name="menuWebDavCheck"
Grid.Row="4"
Grid.Column="1"
Margin="{StaticResource Margin4}"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Content="{x:Static resx:ResUI.LvWebDavCheck}" />
</Grid>
</StackPanel>
</Flyout>
</Button.Flyout>
</Button>
</StackPanel>
<TextBlock
Grid.Row="1"
Grid.Column="0"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Text="{x:Static resx:ResUI.menuRemoteBackup}" />
<Button
Name="menuRemoteBackup"
Grid.Row="1"
Grid.Column="1"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Content="{x:Static resx:ResUI.menuRemoteBackup}" />
<Separator
Grid.Row="2"
Grid.Column="0"
Grid.ColumnSpan="2"
Margin="{StaticResource MarginTb8}" />
<TextBlock
Grid.Row="3"
Grid.Column="0"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Text="{x:Static resx:ResUI.menuRemoteRestore}" />
<Button
Name="menuRemoteRestore"
Grid.Row="3"
Grid.Column="1"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Content="{x:Static resx:ResUI.menuRemoteRestore}" />
</Grid>
</Border>
</StackPanel>
</DockPanel>
</UserControl>