【发布时间】:2013-01-01 04:49:07
【问题描述】:
我定义了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(在组合中选择文本)==> 但我需要标签而不是文本...... :(
【问题讨论】:
标签: wpf xaml dictionary combobox itemtemplate