ux: remove unnecessary controls

This commit is contained in:
leo 2024-07-29 15:07:41 +08:00
parent 29ce95e81e
commit efa02d9e96
No known key found for this signature in database
7 changed files with 48 additions and 44 deletions

View file

@ -384,6 +384,7 @@ namespace SourceGit.ViewModels
{
_changes = null;
FullMessage = string.Empty;
Changes = [];
VisibleChanges = null;
SelectedChanges = null;
ViewRevisionFileContent = null;

View file

@ -8,8 +8,7 @@
xmlns:c="using:SourceGit.Converters"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SourceGit.Views.CommitDetail"
x:DataType="vm:CommitDetail"
Background="{DynamicResource Brush.Window}">
x:DataType="vm:CommitDetail">
<TabControl SelectedIndex="{Binding ActivePageIndex, Mode=TwoWay}" Padding="4">
<!-- Information Page -->
<TabItem>

View file

@ -120,22 +120,26 @@
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
Background="Transparent"/>
<Grid Grid.Row="2" Margin="0,0,4,4">
<Border Background="{DynamicResource Brush.Window}">
<Path Width="128" Height="128"
Data="{StaticResource Icons.Detail}"
HorizontalAlignment="Center"
Fill="{DynamicResource Brush.FG2}"/>
</Border>
<ContentControl Content="{Binding DetailContext}">
<Border Grid.Row="2" Margin="0,0,4,4">
<ContentControl>
<ContentControl.Content>
<Binding Path="DetailContext">
<Binding.TargetNullValue>
<Path Width="128" Height="128"
Data="{StaticResource Icons.Detail}"
HorizontalAlignment="Center"
Fill="{DynamicResource Brush.FG2}"/>
</Binding.TargetNullValue>
</Binding>
</ContentControl.Content>
<ContentControl.DataTemplates>
<DataTemplate DataType="vm:CommitDetail">
<v:CommitDetail/>
</DataTemplate>
</ContentControl.DataTemplates>
</ContentControl>
</Grid>
</Border>
</Grid>
</Grid>
</Grid>

View file

@ -174,15 +174,19 @@
Background="{DynamicResource Brush.Window}"
BorderBrush="{DynamicResource Brush.Border0}"/>
<Grid Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3">
<Border Background="{DynamicResource Brush.Window}">
<Path Width="128" Height="128"
Data="{StaticResource Icons.Detail}"
HorizontalAlignment="Center"
Fill="{DynamicResource Brush.FG2}"/>
</Border>
<ContentControl Content="{Binding DetailContext}">
<Border Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3">
<ContentControl>
<ContentControl.Content>
<Binding Path="DetailContext">
<Binding.TargetNullValue>
<Path Width="128" Height="128"
Data="{StaticResource Icons.Detail}"
HorizontalAlignment="Center"
Fill="{DynamicResource Brush.FG2}"/>
</Binding.TargetNullValue>
</Binding>
</ContentControl.Content>
<ContentControl.DataTemplates>
<DataTemplate DataType="vm:CommitDetail">
<v:CommitDetail/>
@ -193,23 +197,21 @@
</DataTemplate>
<DataTemplate DataType="x:Int32">
<Grid Background="{DynamicResource Brush.Window}">
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
<Path Width="128" Height="128"
Data="{StaticResource Icons.Detail}"
HorizontalAlignment="Center"
Fill="{DynamicResource Brush.FG2}"/>
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
<Path Width="128" Height="128"
Data="{StaticResource Icons.Detail}"
HorizontalAlignment="Center"
Fill="{DynamicResource Brush.FG2}"/>
<TextBlock HorizontalAlignment="Center"
Margin="0,16"
FontSize="24" FontWeight="Bold"
Foreground="{DynamicResource Brush.FG2}"
Text="{Binding Converter={x:Static c:StringConverters.FormatByResourceKey}, ConverterParameter='Histories.Selected'}"/>
</StackPanel>
</Grid>
<TextBlock HorizontalAlignment="Center"
Margin="0,16"
FontSize="24" FontWeight="Bold"
Foreground="{DynamicResource Brush.FG2}"
Text="{Binding Converter={x:Static c:StringConverters.FormatByResourceKey}, ConverterParameter='Histories.Selected'}"/>
</StackPanel>
</DataTemplate>
</ContentControl.DataTemplates>
</ContentControl>
</Grid>
</Border>
</v:LayoutableGrid>
</UserControl>

View file

@ -260,15 +260,14 @@
BorderThickness="0,1,0,0"
BorderBrush="{DynamicResource Brush.Border2}"/>
<Border Grid.Row="2" Background="{DynamicResource Brush.Window}">
<Grid Grid.Row="2">
<Path Width="128" Height="128"
Data="{StaticResource Icons.Detail}"
HorizontalAlignment="Center"
Fill="{DynamicResource Brush.FG2}"/>
</Border>
<Grid Grid.Row="2" IsVisible="{Binding SelectedItem, Converter={x:Static ObjectConverters.IsNotNull}}">
<ContentControl Content="{Binding DetailContext}">
Fill="{DynamicResource Brush.FG2}"
IsVisible="{Binding SelectedItem, Converter={x:Static ObjectConverters.IsNull}}"/>
<ContentControl Content="{Binding DetailContext}" IsVisible="{Binding SelectedItem, Converter={x:Static ObjectConverters.IsNotNull}}">
<ContentControl.DataTemplates>
<DataTemplate DataType="vm:CommitDetail">
<v:CommitDetail/>

View file

@ -25,7 +25,7 @@
</Border>
<!-- Body -->
<Border Grid.Row="1" Background="{DynamicResource Brush.Window}">
<Border Grid.Row="1">
<ContentControl Content="{Binding Data}">
<ContentControl.DataTemplates>
<DataTemplate DataType="vm:Welcome">

View file

@ -8,8 +8,7 @@
xmlns:c="using:SourceGit.Converters"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SourceGit.Views.RevisionCompare"
x:DataType="vm:RevisionCompare"
Background="{DynamicResource Brush.Window}">
x:DataType="vm:RevisionCompare">
<UserControl.DataTemplates>
<DataTemplate DataType="m:Null">
<Border HorizontalAlignment="Center" VerticalAlignment="Center" Background="{DynamicResource Brush.Accent}" CornerRadius="4">