wpf ComboBox绑定Dictionary数据源
程序员文章站
2022-06-07 18:36:06
...
UI界面代码
<ComboBox Height="23" Name="cbHingeAvoidance" Width="250" />
后台代码
Dictionary<int, string> HingeAvoidancedic = new Dictionary<int, string>();
HingeAvoidancedic.Add(1, "铰链避让板件");
HingeAvoidancedic.Add(2, "板件避让铰链");
HingeAvoidancedic.Add(3, "产品内缩避让");
cbHingeAvoidance.SelectedValuePath = "Key";
cbHingeAvoidance.DisplayMemberPath = "Value";
cbHingeAvoidance.ItemsSource = HingeAvoidancedic;
cbHingeAvoidance.SelectedValue = 1;
界面显示效果
上一篇: ,这种多维数组怎么输出呢
下一篇: SQLAlchemy自定义数据类型