0

I have a Listbox that is binded to a Dictionary. The dictionary contains a keyword and a string.

 <ListBox Style="{StaticResource ListBoxStyle}" ItemsSource="{Binding PatientImgResources, UpdateSourceTrigger=PropertyChanged}" SelectedItem="{Binding SelectedKey}"  DisplayMemberPath="Key" />

PatientImgResources is the Dictionary SelectedKey is the Value I want, DisplayMemberPath just shows the keyword.

I want this keyword as my value, unfortunately SelectedKey always contains the whole dictionary entry, keyword plus value. I tried SelectedValuePath="Key" . didn't work so far.

Is it possible to bind to the key? I don't want to use stripped dictionaries.

4

1 に答える 1

1

ItemSourceバインディングでは、「PatientImgResources」の代わりに「PatientImgResources.Keys」を使用します。

于 2012-10-05T09:36:47.440 に答える