[Refactor] Move row and column Grid definitions to attributes

This commit is contained in:
2025-07-08 17:55:44 +01:00
parent 86420a4fd0
commit 563ffcdd32
10 changed files with 52 additions and 138 deletions

View File

@@ -43,14 +43,9 @@
<vm:AboutViewModel />
</Design.DataContext>
<Border Padding="15">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="*" /> <RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid RowDefinitions="Auto,*,Auto">
<Grid Grid.Row="0"
ColumnDefinitions="Auto,*">
<Border Grid.Column="0"
BorderThickness="5">
<Image Source="/Assets/avalonia-logo.ico"
@@ -59,10 +54,8 @@
</Border>
<Grid Grid.Column="1"
HorizontalAlignment="Left"
VerticalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
</Grid.RowDefinitions>
VerticalAlignment="Center"
RowDefinitions="Auto,Auto">
<TextBlock Grid.Row="0"
Text="{Binding SoftwareName}"
HorizontalAlignment="Left"

View File

@@ -44,18 +44,9 @@
<vm:EditDatViewModel />
</Design.DataContext>
<Border Padding="15">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="140" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid RowDefinitions="Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto">
<Grid Grid.Row="0"
ColumnDefinitions="140,*">
<TextBlock Grid.Column="0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
@@ -68,10 +59,8 @@
Text="{Binding Name}"
Padding="5" />
</Grid>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="140" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid Grid.Row="1"
ColumnDefinitions="140,*">
<TextBlock Grid.Column="0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
@@ -84,10 +73,8 @@
Text="{Binding Version}"
Padding="5" />
</Grid>
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="140" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid Grid.Row="2"
ColumnDefinitions="140,*">
<TextBlock Grid.Column="0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
@@ -100,10 +87,8 @@
Text="{Binding Author}"
Padding="5" />
</Grid>
<Grid Grid.Row="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="140" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid Grid.Row="3"
ColumnDefinitions="140,*">
<TextBlock Grid.Column="0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
@@ -116,10 +101,8 @@
Text="{Binding Category}"
Padding="5" />
</Grid>
<Grid Grid.Row="4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="140" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid Grid.Row="4"
ColumnDefinitions="140,*">
<TextBlock Grid.Column="0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
@@ -132,10 +115,8 @@
Text="{Binding Comment}"
Padding="5" />
</Grid>
<Grid Grid.Row="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="140" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid Grid.Row="5"
ColumnDefinitions="140,*">
<TextBlock Grid.Column="0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
@@ -148,10 +129,8 @@
Text="{Binding Date}"
Padding="5" />
</Grid>
<Grid Grid.Row="6">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="140" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid Grid.Row="6"
ColumnDefinitions="140,*">
<TextBlock Grid.Column="0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
@@ -164,10 +143,8 @@
Text="{Binding Description}"
Padding="5" />
</Grid>
<Grid Grid.Row="7">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="140" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid Grid.Row="7"
ColumnDefinitions="140,*">
<TextBlock Grid.Column="0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
@@ -180,10 +157,8 @@
Text="{Binding Homepage}"
Padding="5" />
</Grid>
<Grid Grid.Row="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="140" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid Grid.Row="8"
ColumnDefinitions="140,*">
<TextBlock Grid.Column="0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
@@ -196,10 +171,8 @@
Text="{Binding TotalMachines}"
Padding="5" />
</Grid>
<Grid Grid.Row="9">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="140" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid Grid.Row="9"
ColumnDefinitions="140,*">
<TextBlock Grid.Column="0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
@@ -212,10 +185,8 @@
Text="{Binding CompleteMachines}"
Padding="5" />
</Grid>
<Grid Grid.Row="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="140" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid Grid.Row="10"
ColumnDefinitions="140,*">
<TextBlock Grid.Column="0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
@@ -228,10 +199,8 @@
Text="{Binding IncompleteMachines}"
Padding="5" />
</Grid>
<Grid Grid.Row="11">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="140" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid Grid.Row="11"
ColumnDefinitions="140,*">
<TextBlock Grid.Column="0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
@@ -244,10 +213,8 @@
Text="{Binding TotalRoms}"
Padding="5" />
</Grid>
<Grid Grid.Row="12">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="140" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid Grid.Row="12"
ColumnDefinitions="140,*">
<TextBlock Grid.Column="0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
@@ -260,10 +227,8 @@
Text="{Binding HaveRoms}"
Padding="5" />
</Grid>
<Grid Grid.Row="13">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="140" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid Grid.Row="13"
ColumnDefinitions="140,*">
<TextBlock Grid.Column="0"
HorizontalAlignment="Right"
VerticalAlignment="Center"

View File

@@ -44,11 +44,7 @@
<vm:ExportDatViewModel />
</Design.DataContext>
<Border Padding="15">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid RowDefinitions="Auto,auto,Auto,Auto">
<TextBlock Grid.Row="0"
Text="{Binding StatusMessage}"
HorizontalAlignment="Center" />

View File

@@ -44,12 +44,7 @@
<vm:ExportRomsViewModel />
</Design.DataContext>
<Border Padding="15">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="*" /> <RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid RowDefinitions="Auto,Auto,Auto,Auto,Auto,Auto,Auto,*,Auto">
<StackPanel Grid.Row="0"
Orientation="Horizontal"
HorizontalAlignment="Stretch">

View File

@@ -44,11 +44,7 @@
<vm:ImportDatViewModel />
</Design.DataContext>
<Border Padding="15">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid RowDefinitions="Auto,auto,Auto,Auto">
<TextBlock Grid.Row="0"
Text="{Binding StatusMessage}"
HorizontalAlignment="Center" />

View File

@@ -44,12 +44,7 @@
<vm:ImportDatFolderViewModel />
</Design.DataContext>
<Border Padding="15">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="*" /> <RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid RowDefinitions="Auto,Auto,Auto,Auto,Auto,Auto,Auto,*,Auto">
<StackPanel Grid.Row="0"
Orientation="Horizontal"
HorizontalAlignment="Stretch">
@@ -57,10 +52,8 @@
FontWeight="Bold" />
<TextBlock Text="{Binding FolderPath}" />
</StackPanel>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid Grid.Row="1"
ColumnDefinitions="Auto,*">
<TextBlock Grid.Column="0"
HorizontalAlignment="Right"
VerticalAlignment="Center"

View File

@@ -44,12 +44,7 @@
<vm:ImportRomFolderViewModel />
</Design.DataContext>
<Border Padding="15">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="*" /> <RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid RowDefinitions="Auto,Auto,Auto,Auto,Auto,Auto,Auto,*,Auto">
<StackPanel Grid.Row="0"
Orientation="Horizontal"
HorizontalAlignment="Stretch">

View File

@@ -44,10 +44,7 @@
<vm:RemoveDatViewModel />
</Design.DataContext>
<Border Padding="15">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="auto" />
</Grid.RowDefinitions>
<Grid RowDefinitions="Auto,auto">
<TextBlock Grid.Row="0"
Text="{Binding StatusMessage}"
HorizontalAlignment="Center" />

View File

@@ -43,15 +43,9 @@
<vm:SettingsViewModel />
</Design.DataContext>
<Border Padding="15">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" /> <ColumnDefinition Width="250" /> <ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid RowDefinitions="Auto,Auto,Auto,Auto,Auto,Auto">
<Grid Grid.Row="0"
ColumnDefinitions="*,250,Auto">
<TextBlock Grid.Column="0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
@@ -72,10 +66,8 @@
<TextBlock Text="{x:Static resources:Localization.ChooseLabel}" />
</Button>
</Grid>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" /> <ColumnDefinition Width="250" /> <ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid Grid.Row="1"
ColumnDefinitions="*,250,Auto">
<TextBlock Grid.Column="0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
@@ -96,10 +88,8 @@
<TextBlock Text="{x:Static resources:Localization.ChooseLabel}" />
</Button>
</Grid>
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" /> <ColumnDefinition Width="250" /> <ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid Grid.Row="2"
ColumnDefinitions="*,250,Auto">
<TextBlock Grid.Column="0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
@@ -120,10 +110,8 @@
<TextBlock Text="{x:Static resources:Localization.ChooseLabel}" />
</Button>
</Grid>
<Grid Grid.Row="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" /> <ColumnDefinition Width="250" /> <ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid Grid.Row="3"
ColumnDefinitions="*,250,Auto">
<TextBlock Grid.Column="0"
HorizontalAlignment="Right"
VerticalAlignment="Center"

View File

@@ -42,11 +42,7 @@
<vm:UpdateStatsViewModel />
</Design.DataContext>
<Border Padding="15">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid RowDefinitions="Auto,Auto,*,Auto">
<TextBlock Grid.Row="0"
Text="{Binding StatusMessage}"
HorizontalAlignment="Center" />