小编Tao*_*ias的帖子

WPF组合框绑定

我试图用一些数据绑定一个组合框.问题是我在组合框中有这样的数据:

                            <ComboBox>
                                <ComboBoxItem>Item 1</ComboBoxItem>
                                <ComboBoxItem>Item 2</ComboBoxItem>
                                <ComboBoxItem>Item 3</ComboBoxItem>
                                <ComboBoxItem>Item 4</ComboBoxItem>
                                <ComboBoxItem>Item 5</ComboBoxItem>
                            </ComboBox>
Run Code Online (Sandbox Code Playgroud)

当加载组合框的表单时,我有一个加载的资源,它有一个int,我想将它绑定到这个组合框.因此,如果该int为1,我希望组合框显示项目1等,当我更改组合框的项目时,我想相应地更新该int.

有没有办法将此资源绑定到组合框以实现?

先感谢您

c# wpf binding combobox

1
推荐指数
1
解决办法
1631
查看次数

标签 统计

binding ×1

c# ×1

combobox ×1

wpf ×1