fix: warning about EnumConverters.Equals

This commit is contained in:
leo 2024-05-26 12:17:15 +08:00
parent 5f333fc781
commit dc63e39c69
2 changed files with 8 additions and 12 deletions

View file

@ -1,9 +0,0 @@
using Avalonia.Controls.Converters;
namespace SourceGit.Converters
{
public static class EnumConverters
{
public static readonly EnumToBoolConverter Equals = new EnumToBoolConverter();
}
}

View file

@ -6,6 +6,7 @@
xmlns:vm="using:SourceGit.ViewModels"
xmlns:v="using:SourceGit.Views"
xmlns:c="using:SourceGit.Converters"
xmlns:ac="using:Avalonia.Controls.Converters"
mc:Ignorable="d" d:DesignWidth="500" d:DesignHeight="450"
x:Class="SourceGit.Views.CreateBranch"
x:DataType="vm:CreateBranch">
@ -60,17 +61,21 @@
Margin="0,0,8,0"
Text="{DynamicResource Text.CreateBranch.LocalChanges}"/>
<StackPanel Grid.Row="2" Grid.Column="1" Orientation="Horizontal">
<StackPanel.Resources>
<ac:EnumToBoolConverter x:Key="EnumToBoolConverter"/>
</StackPanel.Resources>
<RadioButton Content="{DynamicResource Text.CreateBranch.LocalChanges.StashAndReply}"
GroupName="LocalChanges"
IsChecked="{Binding PreAction, Mode=TwoWay, Converter={x:Static c:EnumConverters.Equals}, ConverterParameter={x:Static vm:BeforeCreateBranchAction.StashAndReaply}}"/>
IsChecked="{Binding PreAction, Mode=TwoWay, Converter={StaticResource EnumToBoolConverter}, ConverterParameter={x:Static vm:BeforeCreateBranchAction.StashAndReaply}}"/>
<RadioButton Content="{DynamicResource Text.CreateBranch.LocalChanges.Discard}"
GroupName="LocalChanges"
Margin="8,0,0,0"
IsChecked="{Binding PreAction, Mode=TwoWay, Converter={x:Static c:EnumConverters.Equals}, ConverterParameter={x:Static vm:BeforeCreateBranchAction.Discard}}"/>
IsChecked="{Binding PreAction, Mode=TwoWay, Converter={StaticResource EnumToBoolConverter}, ConverterParameter={x:Static vm:BeforeCreateBranchAction.Discard}}"/>
<RadioButton Content="{DynamicResource Text.CreateBranch.LocalChanges.DoNothing}"
GroupName="LocalChanges"
Margin="8,0,0,0"
IsChecked="{Binding PreAction, Mode=TwoWay, Converter={x:Static c:EnumConverters.Equals}, ConverterParameter={x:Static vm:BeforeCreateBranchAction.DoNothing}}"/>
IsChecked="{Binding PreAction, Mode=TwoWay, Converter={StaticResource EnumToBoolConverter}, ConverterParameter={x:Static vm:BeforeCreateBranchAction.DoNothing}}"/>
</StackPanel>
<CheckBox Grid.Row="3" Grid.Column="1"