From d43f88da03d2ea1fb1d2a5cc0e678ccf27366729 Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 25 Jun 2024 17:57:21 +0800 Subject: [PATCH] code_review: PR #208 * make sure there's only one radio button that will change the binding value * remove unused code --- src/Converters/BoolConverters.cs | 21 +-------------------- src/Views/Repository.axaml | 2 +- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/src/Converters/BoolConverters.cs b/src/Converters/BoolConverters.cs index e372eaa9..2eb8c60a 100644 --- a/src/Converters/BoolConverters.cs +++ b/src/Converters/BoolConverters.cs @@ -1,7 +1,4 @@ -using System; -using System.Globalization; - -using Avalonia.Data.Converters; +using Avalonia.Data.Converters; using Avalonia.Media; namespace SourceGit.Converters @@ -16,21 +13,5 @@ namespace SourceGit.Converters public static readonly FuncValueConverter BoldIfTrue = new FuncValueConverter(x => x ? FontWeight.Bold : FontWeight.Regular); - - public class InverseConverter : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - return !(bool)value; - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - return !(bool)value; - } - } - - public static readonly InverseConverter Inverse = new InverseConverter(); - } } diff --git a/src/Views/Repository.axaml b/src/Views/Repository.axaml index 8fac44e0..82e63cb9 100644 --- a/src/Views/Repository.axaml +++ b/src/Views/Repository.axaml @@ -182,7 +182,7 @@ Classes="icon_button" Width="48" GroupName="SearchGroup" - IsChecked="{Binding IsSearching, Mode=TwoWay, Converter={x:Static c:BoolConverters.Inverse}}"> + IsChecked="{Binding !IsSearching, Mode=OneWay}">