【发布时间】:2013-08-30 10:32:55
【问题描述】:
您好,我在 WPF 中有组合框
<ComboBox Name="mcombo" SelectedValuePath="Key" >
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=dictionary}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
我也落后了
Dictionary<string, string> dictionary = new Dictionary<string, string>();
dictionary.Add("val", "valvalval");
我忘记了什么?在组合框中,没有数据!
【问题讨论】:
-
datacontext 设置正确?
-
如何制作datacontex?
标签: c# wpf dictionary combobox