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 :)
我有一个需要显示的组合框,但它不需要数据绑定或其他任何内容,内容是静态的.如何使用 XAML 将静态项目列表添加到我的组合框中?
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屋!
查看全文