1
我定義了Dictionary
,其中包含int作爲鍵和字符串作爲值Dictionary<int, string >
。我做了ComboBoxItem
之間,這Dictionary
結合:如何在組合框項目標記之間進行綁定
<ComboBox ItemsSource="{Binding myDictionary}" >
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Key}" Tag="{Binding Value}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
現在,我想使項目選擇的標籤之間的綁定。我該怎麼做 ? 我知道如何做到這一點,以防萬一我想組合中的SelectedValue(獲得組合中選擇的文本)==>但我需要標籤而不是文本...... :(