diff --git a/src/Converters/BoolConverters.cs b/src/Converters/BoolConverters.cs index c860a1a6..2eb8c60a 100644 --- a/src/Converters/BoolConverters.cs +++ b/src/Converters/BoolConverters.cs @@ -1,18 +1,17 @@ -using Avalonia.Controls; -using Avalonia.Data.Converters; +using Avalonia.Data.Converters; using Avalonia.Media; namespace SourceGit.Converters { public static class BoolConverters { + public static readonly FuncValueConverter ToPageTabWidth = + new FuncValueConverter(x => x ? 200 : double.NaN); + public static readonly FuncValueConverter HalfIfFalse = new FuncValueConverter(x => x ? 1 : 0.5); public static readonly FuncValueConverter BoldIfTrue = new FuncValueConverter(x => x ? FontWeight.Bold : FontWeight.Regular); - - public static readonly FuncValueConverter ToStarOrAutoGridLength = - new(value => value ? new GridLength(1, GridUnitType.Star) : new GridLength(1, GridUnitType.Auto)); } } diff --git a/src/Converters/StringConverters.cs b/src/Converters/StringConverters.cs index 35491a16..aa687f23 100644 --- a/src/Converters/StringConverters.cs +++ b/src/Converters/StringConverters.cs @@ -69,7 +69,7 @@ namespace SourceGit.Converters public static readonly FormatByResourceKeyConverter FormatByResourceKey = new FormatByResourceKeyConverter(); public static readonly FuncValueConverter ToShortSHA = - new FuncValueConverter(v => v.Length > 10 ? v.Substring(0, 10) : v); + new FuncValueConverter(v => v == null ? string.Empty : (v.Length > 10 ? v.Substring(0, 10) : v)); public static readonly FuncValueConverter UnderRecommendGitVersion = new(v => diff --git a/src/Converters/WindowStateConverters.cs b/src/Converters/WindowStateConverters.cs index 2c3b2ac6..7122dc1f 100644 --- a/src/Converters/WindowStateConverters.cs +++ b/src/Converters/WindowStateConverters.cs @@ -3,7 +3,6 @@ using Avalonia; using Avalonia.Controls; using Avalonia.Data.Converters; -using Avalonia.Media; namespace SourceGit.Converters { @@ -39,19 +38,6 @@ namespace SourceGit.Converters } }); - public static readonly FuncValueConverter ToMaxOrRestoreIcon = - new FuncValueConverter(state => - { - if (state == WindowState.Maximized) - { - return Application.Current?.FindResource("Icons.Window.Restore") as StreamGeometry; - } - else - { - return Application.Current?.FindResource("Icons.Window.Maximize") as StreamGeometry; - } - }); - public static readonly FuncValueConverter IsNormal = new FuncValueConverter(state => state == WindowState.Normal); } diff --git a/src/Resources/Styles.axaml b/src/Resources/Styles.axaml index 6b76c2cf..85ccca13 100644 --- a/src/Resources/Styles.axaml +++ b/src/Resources/Styles.axaml @@ -66,6 +66,12 @@ + +