style<*>: small changes for borders and row heights

This commit is contained in:
leo 2021-04-06 14:57:47 +08:00
parent 41f538afce
commit 28bbb80364
4 changed files with 193 additions and 176 deletions

View file

@ -11,9 +11,10 @@
xmlns:converters="clr-namespace:SourceGit.Converters" xmlns:converters="clr-namespace:SourceGit.Converters"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"> d:DesignHeight="450" d:DesignWidth="800">
<Grid x:Name="layout"> <Grid x:Name="layout" Background="{StaticResource Brush.CommitViewer}">
<!-- List Panel (SearchBar + DataGrid) --> <!-- List Panel (SearchBar + DataGrid) -->
<Grid x:Name="commitListPanel" Background="{StaticResource Brush.Contents}" ClipToBounds="True"> <Border x:Name="commitListPanel" Background="{StaticResource Brush.CommitViewer}" BorderBrush="{StaticResource Brush.Border0}" SnapsToDevicePixels="True">
<Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
@ -162,19 +163,21 @@
</DataGrid> </DataGrid>
<!-- Commit Graph --> <!-- Commit Graph -->
<Border x:Name="commitGraphContainer" Grid.Row="1" Width="{Binding ElementName=commitGraphColumn, Path=ActualWidth}" ClipToBounds="True" IsHitTestVisible="False" HorizontalAlignment="Left"> <Border x:Name="commitGraphContainer" Grid.Row="1" Width="{Binding ElementName=commitGraphColumn, Path=ActualWidth}" IsHitTestVisible="False" HorizontalAlignment="Left">
<helpers:CommitGraph <helpers:CommitGraph
x:Name="commitGraph" x:Name="commitGraph"
ClipToBounds="True"
Width="{Binding ElementName=commitGraphContainer, Path=ActualWidth}" Width="{Binding ElementName=commitGraphContainer, Path=ActualWidth}"
Height="{Binding ElementName=commitGraphContainer, Path=ActualHeight}"/> Height="{Binding ElementName=commitGraphContainer, Path=ActualHeight}"/>
</Border> </Border>
</Grid> </Grid>
</Border>
<!-- Split --> <!-- Split -->
<GridSplitter x:Name="splitter" Background="{StaticResource Brush.CommitViewer}"/> <GridSplitter x:Name="splitter" Background="Transparent"/>
<!-- Detail for selected commit --> <!-- Detail for selected commit -->
<Grid x:Name="commitDetailPanel" Background="{StaticResource Brush.CommitViewer}"> <Grid x:Name="commitDetailPanel">
<!-- Selected commit detail --> <!-- Selected commit detail -->
<local:CommitViewer x:Name="commitViewer" Visibility="Collapsed"/> <local:CommitViewer x:Name="commitViewer" Visibility="Collapsed"/>

View file

@ -552,33 +552,37 @@ namespace SourceGit.UI {
layout.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1) }); layout.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1) });
layout.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star), MinWidth = 200 }); layout.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star), MinWidth = 200 });
splitter.HorizontalAlignment = HorizontalAlignment.Center;
splitter.VerticalAlignment = VerticalAlignment.Stretch;
splitter.Width = 1;
splitter.Height = double.NaN;
commitListPanel.BorderThickness = new Thickness(0, 0, 1, 0);
Grid.SetRow(commitListPanel, 0); Grid.SetRow(commitListPanel, 0);
Grid.SetRow(splitter, 0); Grid.SetRow(splitter, 0);
Grid.SetRow(commitDetailPanel, 0); Grid.SetRow(commitDetailPanel, 0);
Grid.SetColumn(commitListPanel, 0); Grid.SetColumn(commitListPanel, 0);
Grid.SetColumn(splitter, 1); Grid.SetColumn(splitter, 1);
Grid.SetColumn(commitDetailPanel, 2); Grid.SetColumn(commitDetailPanel, 2);
splitter.HorizontalAlignment = HorizontalAlignment.Center;
splitter.VerticalAlignment = VerticalAlignment.Stretch;
splitter.Width = 1;
splitter.Height = double.NaN;
} else { } else {
layout.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star), MinHeight = 100 }); layout.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star), MinHeight = 100 });
layout.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1) }); layout.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1) });
layout.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star), MinHeight = 100 }); layout.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star), MinHeight = 100 });
splitter.HorizontalAlignment = HorizontalAlignment.Stretch;
splitter.VerticalAlignment = VerticalAlignment.Center;
splitter.Width = double.NaN;
splitter.Height = 1;
commitListPanel.BorderThickness = new Thickness(0, 0, 0, 1);
Grid.SetRow(commitListPanel, 0); Grid.SetRow(commitListPanel, 0);
Grid.SetRow(splitter, 1); Grid.SetRow(splitter, 1);
Grid.SetRow(commitDetailPanel, 2); Grid.SetRow(commitDetailPanel, 2);
Grid.SetColumn(commitListPanel, 0); Grid.SetColumn(commitListPanel, 0);
Grid.SetColumn(splitter, 0); Grid.SetColumn(splitter, 0);
Grid.SetColumn(commitDetailPanel, 0); Grid.SetColumn(commitDetailPanel, 0);
splitter.HorizontalAlignment = HorizontalAlignment.Stretch;
splitter.VerticalAlignment = VerticalAlignment.Center;
splitter.Width = double.NaN;
splitter.Height = 1;
} }
layout.InvalidateVisual(); layout.InvalidateVisual();

View file

@ -18,15 +18,23 @@
<!-- Left panel --> <!-- Left panel -->
<Grid Grid.Column="0"> <Grid Grid.Column="0">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="24"/> <RowDefinition Height="26"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
<RowDefinition Height="24"/> <RowDefinition Height="26"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<!-- Stashes list toolbar --> <!-- Stashes list toolbar -->
<Border Grid.Row="0" BorderBrush="{StaticResource Brush.Border0}" BorderThickness="0,0,0,1" SnapsToDevicePixels="True"> <Border Grid.Row="0" BorderBrush="{StaticResource Brush.Border0}" BorderThickness="0,0,0,1" SnapsToDevicePixels="True">
<Label Content="{StaticResource Text.Stashes.Stashes}" Foreground="{StaticResource Brush.FG2}" Margin="4,0,0,0" FontWeight="Bold"/> <Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Path Grid.Column="0" Width="12" Height="12" Margin="4,0" Stroke="{StaticResource Brush.FG2}" StrokeThickness="1" Data="{StaticResource Icon.List}" Fill="{StaticResource Brush.FG2}"/>
<Label Grid.Column="1" Content="{StaticResource Text.Stashes.Stashes}" Foreground="{StaticResource Brush.FG2}" Margin="0" FontWeight="Bold"/>
</Grid>
</Border> </Border>
<!-- Stashes list --> <!-- Stashes list -->
@ -70,12 +78,14 @@
<Border Grid.Row="2" BorderBrush="{StaticResource Brush.Border0}" BorderThickness="0,1,0,1" SnapsToDevicePixels="True"> <Border Grid.Row="2" BorderBrush="{StaticResource Brush.Border0}" BorderThickness="0,1,0,1" SnapsToDevicePixels="True">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Label Grid.Column="0" Content="{StaticResource Text.Stashes.Changes}" Foreground="{StaticResource Brush.FG2}" Margin="4,0,0,0" FontWeight="Bold"/> <Path Grid.Column="0" Width="12" Height="12" Margin="4,0" Stroke="{StaticResource Brush.FG2}" StrokeThickness="1" Data="{StaticResource Icon.List}" Fill="{StaticResource Brush.FG2}"/>
<Label Grid.Column="1" Content="{StaticResource Text.Stashes.Changes.Tip}" Foreground="{StaticResource Brush.FG2}" FontSize="10"/> <Label Grid.Column="1" Content="{StaticResource Text.Stashes.Changes}" Foreground="{StaticResource Brush.FG2}" Margin="0" FontWeight="Bold"/>
<Label Grid.Column="2" Content="{StaticResource Text.Stashes.Changes.Tip}" Foreground="{StaticResource Brush.FG2}" FontSize="10"/>
</Grid> </Grid>
</Border> </Border>

View file

@ -36,9 +36,9 @@
<!-- Left --> <!-- Left -->
<Grid Grid.Column="0"> <Grid Grid.Column="0">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="24"/> <RowDefinition Height="26"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
<RowDefinition Height="24"/> <RowDefinition Height="26"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>