小编lcv*_*nny的帖子

如何刷新Windows窗体控件的简单绑定?

我使用以下命令将域对象属性绑定到System.Windows.Forms.Label的Text属性DataBindings:

Label l = new Label();
l.DataBindings.Add(new Binding("Text",myDomainObject,"MyProperty"));
Run Code Online (Sandbox Code Playgroud)

但是,当我更改域对象时,Label不会反映更改.我知道对于像DataGridView这样的复杂控件,可以使用BindingSource完成绑定,我可以在其上调用ResetBindings,但是我找不到任何方法来在Label的简单情况下更新绑定.

.net c# binding

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

标签 统计

.net ×1

binding ×1

c# ×1