enhance: remember the height/width of commit list and detail panel in histories page (#472)

This commit is contained in:
leo 2024-09-14 17:22:29 +08:00
parent 6d92b7fc8c
commit 1a4d3d0086
No known key found for this signature in database
2 changed files with 42 additions and 2 deletions

View file

@ -61,6 +61,30 @@ namespace SourceGit.ViewModels
set => SetProperty(ref _detailContext, value); set => SetProperty(ref _detailContext, value);
} }
public GridLength LeftArea
{
get => _leftArea;
set => SetProperty(ref _leftArea, value);
}
public GridLength RightArea
{
get => _rightArea;
set => SetProperty(ref _rightArea, value);
}
public GridLength TopArea
{
get => _topArea;
set => SetProperty(ref _topArea, value);
}
public GridLength BottomArea
{
get => _bottomArea;
set => SetProperty(ref _bottomArea, value);
}
public Histories(Repository repo) public Histories(Repository repo)
{ {
_repo = repo; _repo = repo;
@ -800,5 +824,10 @@ namespace SourceGit.ViewModels
private Models.Commit _autoSelectedCommit = null; private Models.Commit _autoSelectedCommit = null;
private long _navigationId = 0; private long _navigationId = 0;
private object _detailContext = null; private object _detailContext = null;
private GridLength _leftArea = new GridLength(1, GridUnitType.Star);
private GridLength _rightArea = new GridLength(1, GridUnitType.Star);
private GridLength _topArea = new GridLength(1, GridUnitType.Star);
private GridLength _bottomArea = new GridLength(1, GridUnitType.Star);
} }
} }

View file

@ -10,8 +10,19 @@
x:Class="SourceGit.Views.Histories" x:Class="SourceGit.Views.Histories"
x:DataType="vm:Histories" x:DataType="vm:Histories"
x:Name="ThisControl"> x:Name="ThisControl">
<v:LayoutableGrid RowDefinitions="*,3,*" ColumnDefinitions="*,3,*" <v:LayoutableGrid UseHorizontal="{Binding Source={x:Static vm:Preference.Instance}, Path=UseTwoColumnsLayoutInHistories}">
UseHorizontal="{Binding Source={x:Static vm:Preference.Instance}, Path=UseTwoColumnsLayoutInHistories}"> <v:LayoutableGrid.RowDefinitions>
<RowDefinition Height="{Binding TopArea, Mode=TwoWay}"/>
<RowDefinition Height="3"/>
<RowDefinition Height="{Binding BottomArea, Mode=TwoWay}"/>
</v:LayoutableGrid.RowDefinitions>
<v:LayoutableGrid.ColumnDefinitions>
<ColumnDefinition Width="{Binding LeftArea, Mode=TwoWay}"/>
<ColumnDefinition Width="3"/>
<ColumnDefinition Width="{Binding RightArea, Mode=TwoWay}"/>
</v:LayoutableGrid.ColumnDefinitions>
<Grid Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3"> <Grid Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3">
<Grid RowDefinitions="24,*"> <Grid RowDefinitions="24,*">
<!-- Headers --> <!-- Headers -->