Displaying the selected item differently in ComboBox
Posted
by David Brunelle
on Stack Overflow
See other posts from Stack Overflow
or by David Brunelle
Published on 2009-09-23T15:04:40Z
Indexed on
2010/03/13
9:15 UTC
Read the original article
Hit count: 445
I have a combo box in which I set up an ItemTemplate
that looks something like this:
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Piece.NoPiece}" Width="50" />
<TextBlock Text="{Binding Piece.Description}" Width="170" />
<TextBlock Text="{Binding Piece.Categorie.NomCategorie}" />
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
As you can see, I got three columns that let the user see different piece of information. However, I would like the selected item in the combo to display only the second column. In other word, is there a way to have an ItemTemplate
that displays items in a different manner when you scroll down versus when it's closed and you only see the selection?
© Stack Overflow or respective owner