Skip to content

Commit 53c6fc8

Browse files
committed
fix: remove binding error in debug mode (#1338)
Signed-off-by: leo <[email protected]>
1 parent f0d1d46 commit 53c6fc8

File tree

6 files changed

+11
-6
lines changed

6 files changed

+11
-6
lines changed

src/Converters/ListConverters.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ namespace SourceGit.Converters
77
{
88
public static class ListConverters
99
{
10+
public static readonly FuncValueConverter<IList, string> Count =
11+
new FuncValueConverter<IList, string>(v => v == null ? "0" : $"{v.Count}");
12+
1013
public static readonly FuncValueConverter<IList, string> ToCount =
1114
new FuncValueConverter<IList, string>(v => v == null ? "(0)" : $"({v.Count})");
1215

src/Resources/Locales/en_US.axaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
<x:String x:Key="Text.CommitCM.Squash" xml:space="preserve">Squash into Parent</x:String>
126126
<x:String x:Key="Text.CommitCM.SquashCommitsSinceThis" xml:space="preserve">Squash Children into Here</x:String>
127127
<x:String x:Key="Text.CommitDetail.Changes" xml:space="preserve">CHANGES</x:String>
128-
<x:String x:Key="Text.CommitDetail.Changes.Count" xml:space="preserve">{0} changed file(s)</x:String>
128+
<x:String x:Key="Text.CommitDetail.Changes.Count" xml:space="preserve">changed file(s)</x:String>
129129
<x:String x:Key="Text.CommitDetail.Changes.Search" xml:space="preserve">Search Changes...</x:String>
130130
<x:String x:Key="Text.CommitDetail.Files" xml:space="preserve">FILES</x:String>
131131
<x:String x:Key="Text.CommitDetail.Files.LFS" xml:space="preserve">LFS File</x:String>

src/Resources/Locales/zh_CN.axaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
<x:String x:Key="Text.CommitCM.Squash" xml:space="preserve">合并此提交到上一个提交</x:String>
130130
<x:String x:Key="Text.CommitCM.SquashCommitsSinceThis" xml:space="preserve">合并之后的提交到此处</x:String>
131131
<x:String x:Key="Text.CommitDetail.Changes" xml:space="preserve">变更对比</x:String>
132-
<x:String x:Key="Text.CommitDetail.Changes.Count" xml:space="preserve">{0} 个文件发生变更</x:String>
132+
<x:String x:Key="Text.CommitDetail.Changes.Count" xml:space="preserve">个文件发生变更</x:String>
133133
<x:String x:Key="Text.CommitDetail.Changes.Search" xml:space="preserve">查找变更...</x:String>
134134
<x:String x:Key="Text.CommitDetail.Files" xml:space="preserve">文件列表</x:String>
135135
<x:String x:Key="Text.CommitDetail.Files.LFS" xml:space="preserve">LFS文件</x:String>

src/Resources/Locales/zh_TW.axaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
<x:String x:Key="Text.CommitCM.Squash" xml:space="preserve">合併此提交到上一個提交</x:String>
130130
<x:String x:Key="Text.CommitCM.SquashCommitsSinceThis" xml:space="preserve">合併之後的提交到此處</x:String>
131131
<x:String x:Key="Text.CommitDetail.Changes" xml:space="preserve">變更對比</x:String>
132-
<x:String x:Key="Text.CommitDetail.Changes.Count" xml:space="preserve">更改了 {0} 個檔案</x:String>
132+
<x:String x:Key="Text.CommitDetail.Changes.Count" xml:space="preserve">個檔案已變更</x:String>
133133
<x:String x:Key="Text.CommitDetail.Changes.Search" xml:space="preserve">搜尋變更...</x:String>
134134
<x:String x:Key="Text.CommitDetail.Files" xml:space="preserve">檔案列表</x:String>
135135
<x:String x:Key="Text.CommitDetail.Files.LFS" xml:space="preserve">LFS 檔案</x:String>

src/Views/CommitChanges.axaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,10 @@
5858
<Border Grid.Row="2" BorderBrush="{DynamicResource Brush.Border2}" BorderThickness="1,0,1,1" Background="Transparent">
5959
<TextBlock Margin="4,0,0,0"
6060
Foreground="{DynamicResource Brush.FG2}"
61-
Text="{Binding Changes.Count, Converter={x:Static c:StringConverters.FormatByResourceKey}, ConverterParameter='CommitDetail.Changes.Count', Mode=OneWay}"
62-
HorizontalAlignment="Left" VerticalAlignment="Center"/>
61+
HorizontalAlignment="Left" VerticalAlignment="Center">
62+
<Run Text="{Binding Changes, Converter={x:Static c:ListConverters.Count}, Mode=OneWay}" FontWeight="Bold"/>
63+
<Run Text="{DynamicResource Text.CommitDetail.Changes.Count}"/>
64+
</TextBlock>
6365
</Border>
6466
</Grid>
6567

src/Views/TagsView.axaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
<TextBlock Grid.Column="2"
6666
Classes="primary"
6767
Margin="8,0,0,0">
68-
<Run Text="{Binding FullPath, Converter={x:Static c:PathConverters.PureFileName}}"/>
68+
<Run Text="{Binding FullPath, Converter={x:Static c:PathConverters.PureFileName}, Mode=OneWay}"/>
6969
<Run Text="{Binding TagsCount}" Foreground="{DynamicResource Brush.FG2}"/>
7070
</TextBlock>
7171

0 commit comments

Comments
 (0)