refactor: use DataGrid instead of ListBox displaying history commits

Sometimes, `Grid.IsSharedSizeScope` does not work when navigating to the first commit

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo
2025-06-30 15:01:18 +08:00
parent db77c61dd5
commit 93ffbdd21d
8 changed files with 236 additions and 223 deletions

View File

@@ -300,7 +300,7 @@ namespace SourceGit.ViewModels
}
}
public ContextMenu MakeContextMenu(ListBox list)
public ContextMenu MakeContextMenu(DataGrid list)
{
var current = _repo.CurrentBranch;
if (current == null || list.SelectedItems == null)

View File

@@ -41,12 +41,6 @@ namespace SourceGit.ViewModels
set => SetProperty(ref _repositorySidebarWidth, value);
}
public GridLength HistoriesAuthorColumnWidth
{
get => _historiesAuthorColumnWidth;
set => SetProperty(ref _historiesAuthorColumnWidth, value);
}
public GridLength WorkingCopyLeftWidth
{
get => _workingCopyLeftWidth;
@@ -72,7 +66,6 @@ namespace SourceGit.ViewModels
}
private GridLength _repositorySidebarWidth = new GridLength(250, GridUnitType.Pixel);
private GridLength _historiesAuthorColumnWidth = new GridLength(120, GridUnitType.Pixel);
private GridLength _workingCopyLeftWidth = new GridLength(300, GridUnitType.Pixel);
private GridLength _stashesLeftWidth = new GridLength(300, GridUnitType.Pixel);
private GridLength _commitDetailChangesLeftWidth = new GridLength(256, GridUnitType.Pixel);

View File

@@ -871,7 +871,7 @@ namespace SourceGit.ViewModels
Task.Run(() =>
{
List<Models.Commit> visible = [];
var visible = new List<Models.Commit>();
var method = (Models.CommitSearchMethod)_searchCommitFilterType;
if (method == Models.CommitSearchMethod.BySHA)
@@ -880,8 +880,8 @@ namespace SourceGit.ViewModels
if (isCommitSHA)
{
var commit = new Commands.QuerySingleCommit(_fullpath, _searchCommitFilter).Result();
visible = [commit];
}
visible.Add(commit);
}
}
else
{