为什么数据绑定了的CheckedListBox"隐藏"? [英] Why is Databinding for a CheckedListBox "Hidden"?
问题描述
CheckedListBox上的DataSource属性从Intellisense中隐藏。为什么?你可以使用绑定属性使它工作,但我担心它是隐藏的一个原因,我不应该在CheckedListBox数据绑定一些重要的原因,我不知道。
The DataSource property on a CheckedListBox is hidden from Intellisense. Why? You can use the binding properties to make it work, but I'm worried that it's hidden for a reason and that I shouldn't be databinding on a CheckedListBox for some important reason that I'm not aware of.
在CheckedListBox上的数据绑定是否正确
Is databinding on a CheckedListBox ok??
推荐答案
CheckedListBox
是意在与其 添加
和
The CheckedListBox
is intended to be used with its Add
and AddRange
methods:
在运行
时将对象添加到列表,使用AddRange
方法分配对象
引用的数组。
然后列表显示每个对象的默认
字符串值。您可以
使用
将添加方法添加到列表中。
To add objects to the list at run time, assign an array of object references with the
AddRange
method. The list then displays the default string value for each object. You can add individual items to the list with theAdd
method.
虽然数据绑定到 CheckedListBox
可能工作,你应该避免创建依赖关系的任何东西,但公共接口的类型。我建议你使用正确的方法,因为这将使你的代码不那么脆弱的事情,微软更改的实现 CheckedListBox
。
While data binding to the CheckedListBox
may work you ought to avoid creating dependencies on anything but the public interface of a type. I would recommend that you use the proper methods as this will make you code less brittle in the event that Microsoft changes the implementation of CheckedListBox
.
这篇关于为什么数据绑定了的CheckedListBox"隐藏"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!