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; _changes = null;
FullMessage = string.Empty; FullMessage = string.Empty;
Changes = [];
VisibleChanges = null; VisibleChanges = null;
SelectedChanges = null; SelectedChanges = null;
ViewRevisionFileContent = null; ViewRevisionFileContent = null;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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