问题
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.
Is databinding on a CheckedListBox ok??
回答1:
The CheckedListBox is intended to be used with its Add and AddRange methods:
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.
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
.
来源:https://stackoverflow.com/questions/1346686/why-is-databinding-for-a-checkedlistbox-hidden