I want to add an item to the combobox after binding it.
for example:
this.cbCategory.ItemsSource = categoryList;
this.cbCategory.DisplayMemberPath = "CategoryName";
this.cbCategory.SelectedValuePath = "CategoryID";
i want to add(“All”, “%”) as the first one.
Geetha.
This is very simple using a CompositeCollection:
How it works: The CompositeCollection produes the “All” item followed by all of the items in the CategoryList collection. Note that
<my:Item ... />is the constructor for your item class. You will need to change it to your actual namespace and class name.Important advice: I notice you are setting some ComboBox properties in code-behind. This is a very bad practice. You should use XAML as shown above.