次のシナリオがあります
1-xaml のコンボボックス
<ComboBox
x:Name="PublishableCbo" Width="150" IsEnabled="True" HorizontalAlignment="Left" Height="20"
SelectedValue="{Binding Path=Published, Mode=TwoWay}"
Grid.Column="6" Grid.Row="0">
<ComboBox.Items>
<ComboBoxItem Content="All" IsSelected="True" />
<ComboBoxItem Content="Yes" />
<ComboBoxItem Content="No" />
</ComboBox.Items>
2-モデルクラスで、プロパティを定義し、コンボボックスで選択した値にバインドしました
public bool Published
{
get
{
return _published;
}
set
{
_published = value;
OnPropertyChanged("Published");
}
}
コンバーターを実装する必要があることはわかっていますが、正確な方法はわかりません。私が欲しいのは、モデルでYes/Noを選択するとTrue/Falseの値が得られ、「すべて」が選択されたときにnull値を取得することです。