简体   繁体   English

为什么CheckedListBox的数据绑定“隐藏”?

[英]Why is Databinding for a CheckedListBox “Hidden”?

The DataSource property on a CheckedListBox is hidden from Intellisense. CheckedListBox上的DataSource属性对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: CheckedListBox旨在与AddAddRange方法一起使用:

To add objects to the list at run time, assign an array of object references with the AddRange method. 要在运行时向列表添加对象,请使用AddRange方法分配对象引用数组。 The list then displays the default string value for each object. 然后列表显示每个对象的默认字符串值。 You can add individual items to the list with the Add method. 您可以使用Add方法将单个项目添加到列表中。

While data binding to the CheckedListBox may work you ought to avoid creating dependencies on anything but the public interface of a type. 虽然绑定到CheckedListBox数据可能有效,但您应该避免在除类型的公共接口之外的任何内容上创建依赖关系。 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 . 我建议您使用正确的方法,因为这将使您在Microsoft更改CheckedListBox的实现时不那么脆弱。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM