I am unable to find a solution for this.. I have a ListBox, whose DataTemplate has a ComboBox. DataBinding is in place, this is kind of collection of collections scenario. I want to preprend a 'Select One Item' to all ComboBoxes. How do I do that?
EDIT: Really not sure why you would need code/xaml for above question. But below anyway:
<Resources>
<ResourceDictionary>
<DataTemplate x:Key="CategoriesDataTemplate">
<StackPanel Orientation="vertical">
<TextBlock Text="{Binding Path=CategoryName}"></TextBlock>
<ComboBox ItemsSource="{Binding Path=Products}" Background="Transparent" SelectedValuePath="ProductId" DisplayMemberPath="ProductName">
</ComboBox>
</StackPanel>
</DataTemplate>
</ResourceDictionary>
</Resources>
.....
<Grid..>
<ListBox ItemsSource="{Binding Categories}" ItemTemplate="{DynamicResource CategoriesDataTemplate}">
</Grid>
For each category, I will display the category name and a combobox of its products below. User can select one product per category. For each such combobox, I want the first item to be "Select a Product" or something such. Note: I am looking to see if there is a way to do it WITHOUT pre-pending a item to each of my Products collection in each Category(I do not wish to mess with the source collections if possible). Some sort of event handler approach?