Skip to content

Commit

Permalink
修复不显示【输出方式】列后再重新显示,输出方式列中的复选框变为未选中状态的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
hrpzcf committed Dec 31, 2023
1 parent fcdc9c1 commit d1046f7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
7 changes: 0 additions & 7 deletions HashCalculator/ViewModels/HashViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -425,13 +425,6 @@ public ICommand ShowHashDetailsWindowCmd
}
}

public GenericItemModel[] AvailableOutputTypes { get; } =
{
new GenericItemModel("Base64", OutputType.BASE64),
new GenericItemModel("Hex大写", OutputType.BinaryUpper),
new GenericItemModel("Hex小写", OutputType.BinaryLower),
};

private void MakeSureAlgoModelArrayNotEmpty()
{
if (!this.AlgoInOutModels?.Any() ?? true)
Expand Down
10 changes: 9 additions & 1 deletion HashCalculator/ViewModels/SettingsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,15 @@ public ICommand OpenEditContextMenuCmd
}

[XmlIgnore]
public GenericItemModel[] AvailableOutputTypes { get; } =
public static GenericItemModel[] AvailableOutputTypes { get; } =
{
new GenericItemModel("Base64", OutputType.BASE64),
new GenericItemModel("Hex大写", OutputType.BinaryUpper),
new GenericItemModel("Hex小写", OutputType.BinaryLower),
};

[XmlIgnore]
public static GenericItemModel[] AvailableOutputTypesLong { get; } =
{
new GenericItemModel("Base64 格式", OutputType.BASE64),
new GenericItemModel("十六进制大写", OutputType.BinaryUpper),
Expand Down
4 changes: 2 additions & 2 deletions HashCalculator/Views/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
Width="110"
VerticalAlignment="Center"
DisplayMemberPath="Display"
ItemsSource="{Binding Source={x:Static local:Settings.Current}, Path=AvailableOutputTypes}"
ItemsSource="{Binding Path=(local:SettingsViewModel.AvailableOutputTypesLong)}"
SelectedValue="{Binding Source={x:Static local:Settings.Current}, Path=SelectedOutputType}"
SelectedValuePath="ItemValue"
Style="{StaticResource ComboBoxStyle1}"
Expand Down Expand Up @@ -589,7 +589,7 @@
Margin="2"
VerticalAlignment="Center"
DisplayMemberPath="Display"
ItemsSource="{Binding AvailableOutputTypes}"
ItemsSource="{Binding Path=(local:SettingsViewModel.AvailableOutputTypes)}"
SelectedValue="{Binding SelectedOutputType, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
SelectedValuePath="ItemValue"
Style="{StaticResource ComboBoxStyle2}"
Expand Down

0 comments on commit d1046f7

Please sign in to comment.