would possibly do the job, the best way to get a databound checkboxlist is to use RadListBox
. You can do this by using the RadListBox.ListBoxElement.ItemDataBound
event which fires on every data record during the binding process. You should attach to it when the form is initially created before the data source is filled with data or before binding the listbox control.
The code in the event handler should look like this:
| private void ListBoxElement_ItemDataBound(object sender, ItemDataBoundEventArgs e)
| RadListBoxItem item = e.DataBoundItem as RadListBoxItem;
| item.Children.Children.Margin = new Padding(15, 0, 0, 0);
| RadCheckBoxElement chBox = new RadCheckBoxElement();
| chBox.StretchHorizontally = false;
| chBox.StretchVertically = false;
This code changes the default structure of the RadListBoxItem
and adds a RadCheckBoxElement
. Finally, you'll further enhance the custom listbox item by adding mouse and keyboard events to set up your custom logic.
If you have any additional questions, please do not hesitate to write us.
the Telerik team