fix<WorkingCopy>: force trigger DataGrid layout update to fix bad column with issue

This commit is contained in:
leo 2021-01-12 20:49:48 +08:00
parent 57a02b1d86
commit 2054df31b9
2 changed files with 8 additions and 2 deletions

View file

@ -231,7 +231,7 @@
<TreeView
Grid.Row="1"
x:Name="stageTree"
ItemsSource="{Binding ElementName=me, Path=StagedTreeData, IsAsync=True}"
ItemsSource="{Binding ElementName=me, Path=StagedTreeData, IsAsync=False}"
Visibility="{Binding Source={x:Static source:App.Setting}, Path=UI.StagedFileDisplayMode, Converter={StaticResource FilesDisplayModeToTree}}"
Background="{StaticResource Brush.Contents}"
FontFamily="Consolas"
@ -286,7 +286,7 @@
<DataGrid
Grid.Row="1"
x:Name="stageList"
ItemsSource="{Binding ElementName=me, Path=StagedListData, IsAsync=True}"
ItemsSource="{Binding ElementName=me, Path=StagedListData, IsAsync=False}"
RowHeight="24"
Visibility="{Binding Source={x:Static source:App.Setting}, Path=UI.StagedFileDisplayMode, Converter={StaticResource FilesDisplayModeToList}}"
SelectionChanged="StagedListSelectionChanged"

View file

@ -114,6 +114,12 @@ namespace SourceGit.UI {
UpdateData(unstaged, UnstagedListData, UnstagedTreeData);
UpdateData(staged, StagedListData, StagedTreeData);
// Force trigger UpdateLayout for DataGrid.
unstagedList.Columns.Add(new DataGridTextColumn());
unstagedList.Columns.RemoveAt(unstagedList.Columns.Count - 1);
stageList.Columns.Add(new DataGridTextColumn());
stageList.Columns.RemoveAt(stageList.Columns.Count - 1);
var current = Repo.CurrentBranch();
if (current != null && !string.IsNullOrEmpty(current.Upstream) && chkAmend.IsChecked != true) {
btnCommitAndPush.Visibility = Visibility.Visible;