Edit this page

In Code Behind

This tutorial will walk you through the common tasks of adding and removing RadListBoxItems programmatically.

Here is a regular RadListBox declaration without items:

Declaring RadListBox

<telerik:RadListBox x:Name="radListBox" Width="200">            

Adding RadListBoxItems

In order to add new listbox items to a RadListBox control, you have to perform several simple steps:

  • Create an instance of the RadListBoxItem class.

  • Set its properties such as Content, Foreground, etc.

  • Add it to the RadListBox's Items collection.

Populating RadListBox with items from code-behind

var item1 = new RadListBoxItem() { Content = "Australia" };
var item2 = new RadListBoxItem() { Content = "Brazil" };

The result is shown on the image below:

radlistbox populatingwithdata incodebehind

Removing RadListBoxItems

In order to remove a specific RadListBoxItem, you should remove it from the RadListBox's Items collection.

Removing RadListBoxItems

private void RemoveListBoxItem(RadListBoxItem itemToRemove)

See Also

Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article