Alternative Content for a Selected ComboBoxItem
I need to place a ComboBox
in a place where I have very limited space. Is there any way to show content for the SelectedItem
in the ComboBox
that is different than the content that is displayed for the item in the ComboBox
's Popup
?
As an example, Firefox does this with it's Site Search 开发者_开发百科box in the top right of the browser. When you open the dropdown, the site names are displayed along with their respective logos, but when a site is selected, only the icon is displayed.
UPDATE: Solution found :-)
I found a solution at this site:
http://blogs.windowsclient.net/airborneengineer/archive/2009/06/25/wpf-styles-and-templates-part-ii-combobox-customization.aspx
I just needed to modify the "DisplayImageWithText" DataTemplate to only show the field I want.
Yes, have 2 sets of data and change the display member column of the combobox - according to the position. as long as the value is the same, it will work good, and you'll get 2 displays out of the same combo-box.
精彩评论