我使用以下命令将域对象属性绑定到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的简单情况下更新绑定.