code_review: PR #208

* make sure there's only one radio button that will change the binding value
* remove unused code
This commit is contained in:
leo 2024-06-25 17:57:21 +08:00
parent b50ae21699
commit d43f88da03
No known key found for this signature in database
2 changed files with 2 additions and 21 deletions

View file

@ -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<bool, FontWeight> BoldIfTrue =
new FuncValueConverter<bool, FontWeight>(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();
}
}

View file

@ -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}">
<Path Width="14" Height="14" Stretch="Fill" HorizontalAlignment="Center" Data="{StaticResource Icons.Home}"/>
</RadioButton>