Home > DeveloperSection > Interviews > Q: Why should I bother wrapping items in a ComboBoxItem?

Posted on    March-11-2011 12:00 AM

 1 Answer(s)
  1229  View(s)
Rate this:

Awadhendra Tiwari

Total Post:510

Posted on    March-11-2011 1:00 AM

ComboBoxItem exposes some useful properties—IsSelected andIsHighlighted—and
useful events—Selected and Unselected. Using ComboBoxItem also avoids a quirkybehavior with showing content controls in the selection box (when IsEditable isfalse): If an item in a ComboBox is a content control, the entire controldoesn’t get displayed in the selection box. Instead, the inner content isextracted and shown. By using ComboBoxItem as the outermost content control,the inner content is now the entire control that you probably wanted to bedisplayed in the first place.
Because ComboBoxItem is a content control, it is also handy for adding simplestrings to a
ComboBox (rather than using something like TextBlock or Label).

Don't want to miss updates? Please click the below button!

Follow MindStick