I have 10 ComboBox controls that will use the same item template (an Image and a Textblock), and the same items, so I want to define this template on a more global scale (page level). This is what I've done so far:
<UserControl.Resources>
<DataTemplate x:Name="CBItem">
<StackPanel Orientation="Horizontal">
<Image Source="{Binding ImageSource}"></Image>
<TextBlock Text="{Binding TextLabel}"></TextBlock>
</StackPanel>
</DataTemplate>
</UserControl.Resources>
The problem is that I don't know how to use this resource in the following 10 ComboBox controls. I've tried something like
<ComboBox Height="25">
<ComboBox.ItemTemplate>
<DataTemplate x:Name="{StaticResource CBItem}"></DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
But it doesn't work. Any help?