fix: change list in grid mode looks and works weird (#157)

This commit is contained in:
leo 2024-06-01 12:46:31 +08:00
parent 9d9dd6acb5
commit f1ff969090
4 changed files with 9 additions and 16 deletions

View file

@ -52,9 +52,9 @@
<x:String x:Key="Text.Bytes" xml:space="preserve">Bytes</x:String>
<x:String x:Key="Text.Cancel" xml:space="preserve">CANCEL</x:String>
<x:String x:Key="Text.ChangeDisplayMode" xml:space="preserve">CHANGE DISPLAY MODE</x:String>
<x:String x:Key="Text.ChangeDisplayMode.Grid" xml:space="preserve">Show as Grid</x:String>
<x:String x:Key="Text.ChangeDisplayMode.List" xml:space="preserve">Show as List</x:String>
<x:String x:Key="Text.ChangeDisplayMode.Tree" xml:space="preserve">Show as Tree</x:String>
<x:String x:Key="Text.ChangeDisplayMode.Grid" xml:space="preserve">Show as File and Dir List</x:String>
<x:String x:Key="Text.ChangeDisplayMode.List" xml:space="preserve">Show as Path List</x:String>
<x:String x:Key="Text.ChangeDisplayMode.Tree" xml:space="preserve">Show as Filesystem Tree</x:String>
<x:String x:Key="Text.Checkout" xml:space="preserve">Checkout Branch</x:String>
<x:String x:Key="Text.Checkout.Commit" xml:space="preserve">Checkout Commit</x:String>
<x:String x:Key="Text.Checkout.Commit.Warning" xml:space="preserve">Warning: By doing a commit checkout, your Head will be detached</x:String>

View file

@ -55,9 +55,9 @@
<x:String x:Key="Text.Bytes" xml:space="preserve">字节</x:String>
<x:String x:Key="Text.Cancel" xml:space="preserve">取 消</x:String>
<x:String x:Key="Text.ChangeDisplayMode" xml:space="preserve">切换变更显示模式</x:String>
<x:String x:Key="Text.ChangeDisplayMode.Grid" xml:space="preserve">网格模式</x:String>
<x:String x:Key="Text.ChangeDisplayMode.List" xml:space="preserve">列表模式</x:String>
<x:String x:Key="Text.ChangeDisplayMode.Tree" xml:space="preserve">树形模式</x:String>
<x:String x:Key="Text.ChangeDisplayMode.Grid" xml:space="preserve">文件名+路径列表模式</x:String>
<x:String x:Key="Text.ChangeDisplayMode.List" xml:space="preserve">全路径列表模式</x:String>
<x:String x:Key="Text.ChangeDisplayMode.Tree" xml:space="preserve">文件目录树形结构模式</x:String>
<x:String x:Key="Text.Checkout" xml:space="preserve">检出(checkout)分支</x:String>
<x:String x:Key="Text.Checkout.Commit" xml:space="preserve">检出(checkout)提交</x:String>
<x:String x:Key="Text.Checkout.Commit.Warning" xml:space="preserve">注意执行该操作后当前HEAD会变为游离(detached)状态!</x:String>

View file

@ -31,15 +31,12 @@
</StackPanel>
</DataTemplate>
<DataTemplate x:Key="GridModeFileTemplate" DataType="m:Change">
<DataTemplate x:Key="GridModeTemplate" DataType="m:Change">
<StackPanel Orientation="Horizontal">
<v:ChangeStatusIcon Width="14" Height="14" IsWorkingCopyChange="{Binding #me.IsWorkingCopyChange}" Change="{Binding}" Margin="4,0,0,0"/>
<TextBlock Classes="monospace" Text="{Binding Path, Converter={x:Static c:PathConverters.PureFileName}}" Margin="4,0"/>
</StackPanel>
</DataTemplate>
<DataTemplate x:Key="GridModeDirTemplate" DataType="m:Change">
<TextBlock Classes="monospace" Text="{Binding Path, Converter={x:Static c:PathConverters.PureDirectoryName}}" Foreground="{DynamicResource Brush.FG2}"/>
</StackPanel>
</DataTemplate>
</TreeDataGrid.Resources>
</TreeDataGrid>

View file

@ -155,11 +155,7 @@ namespace SourceGit.Views
{
var source = new FlatTreeDataGridSource<Models.Change>(changes)
{
Columns =
{
new TemplateColumn<Models.Change>(null, "GridModeFileTemplate", null, GridLength.Auto),
new TemplateColumn<Models.Change>(null, "GridModeDirTemplate", null, GridLength.Auto)
},
Columns = { new TemplateColumn<Models.Change>(null, "GridModeTemplate", null, GridLength.Auto) },
};
var selection = new Models.TreeDataGridSelectionModel<Models.Change>(source, null);