I have a ComboBox with a custom ItemTemplate .
<ComboBox Height="20" Width="200" SelectedItem="{Binding Path=SelectedDesign}" ItemsSource="{Binding Path=Designs}" HorizontalAlignment="Left" ScrollViewer.CanContentScroll="False"> <ComboBox.ItemTemplate> <DataTemplate DataType="{x:Type formdesign:FormDesignContainer}"> <Rectangle Width="200" Height="100"> <Rectangle.Fill> <ImageBrush ImageSource="{Binding Path=ImageThumb}" Stretch="Uniform" /> </Rectangle.Fill> </Rectangle> </DataTemplate> </ComboBox.ItemTemplate> </ComboBox>
It works well. However, WPF is trying to draw a rectangle as Combobox text. How can I set the "text" for this template. By "text" I mean a string or control that represents the selected item and is written to the combo box when the item is selected
In other words, I would like to do this:

But now I got it

source share