什么是Delphi的DisableControls/ C#等效EnableControls方法(用于在迭代底层数据集时禁用数据绑定控件的更新)?我用谷歌搜索了半个小时,没有找到答案......
我有一个列表框和一个绑定到绑定源的丰富编辑框,但我需要执行一个迭代整个数据集的操作,并且当我在底层数据集中移动时,两个控件都会更新.在Delphi中,这很容易:将执行迭代的块包含在DisableControls和之间EnableControls.我找不到C#/ .NET等价物,我看起来真的很难!
我现在无法访问 Visual Studio,因此无法对此进行测试,但请查看控件实例的方法。代码如:
// set the Enabled property of
// the controls to False; this should
// disable the controls for user access
listBox.Enabled = False;
richEditBox.Enabled = False;
// perform iteration
// and other operations
// set the Enabled property back
// to True
listBox.Enabled = True;
richEditBox.Enabled = True;
Run Code Online (Sandbox Code Playgroud)
该属性的确切名称可能略有不同,但我很确定它就是这样。