WPF - 将静态项添加到组合框 [英] WPF - add static items to a combo box
本文介绍了WPF - 将静态项添加到组合框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我以前说过,我会再说一遍,WPF的最简单的例子也是最难在网上找到:)
I've said it before and I'll say it again, the easiest examples for WPF are also the hardest to find on the web :)
我有一个组合框,我需要显示,但它不需要是数据绑定或任何其他,内容是静态的。
I have a combo box that I need to display but it doesn't need to be databound or anything else, the content is static. How can I add a static list of items to my combo box using XAML?
推荐答案
这里是MSDN的代码和链接 - 文章链接,您应该查看更多详细信息。
Here is the code from MSDN and the link - Article Link, which you should check out for more detail.
<ComboBox Text="Is not open">
<ComboBoxItem Name="cbi1">Item1</ComboBoxItem>
<ComboBoxItem Name="cbi2">Item2</ComboBoxItem>
<ComboBoxItem Name="cbi3">Item3</ComboBoxItem>
</ComboBox>
这篇关于WPF - 将静态项添加到组合框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文