0
非常に単純な使用例:プロパティがNotifyPropertyChanged()
の場合、Dictionary<string, string>
に静的データとコンボボックスがあります。WPFコンボボックスの辞書へのバインド - 間違った値が返される
CBがそうのように定義されています。
<ComboBox ItemsSource="{Binding AllThings}" DisplayMemberPath="Value"
SelectedValuePath="Key" SelectedItem="{Binding Thing, Mode=TwoWay,
UpdateSourceTrigger=PropertyChanged}">
VMが含まれています
ユーザーは代わりに "B" 私は取得しています奇妙な文字列の値を選択public Dictionary<string, string> AllThings { get; set; }= new Dictionary<string, string>{["a"] = "b"};
private string thing;
public string Thing
{
get
{
return this.thing;
}
set
{
if (this.thing != value)
{
this.thing = value;
this.OnPropertyChanged();
}
}
}
: Thing
セッター内のvalue
内の[a, b]
。
「b」を表示して「a」を「する」に保存したいとします。 b
にはなりませんThing
b
に設定同様に
UPDは、リストで選択されています。
ありがとうございました。長い一日だった... – zaitsman