Custom Combo Box RRS feed

  • Question

  • I need to create a custom look-and-feel for combo boxes and I'm starting to run into issues. Right now, I'm trying to create a combo box whose items remain constant and have icons for each item. What is the best way to create this in Expression?

    I tried following the tutorial in the user guide, but it's kind of worthless. My current attempt, which keeps failing, involves me creating the exact look I want with grids, textblocks, and such and then creating a control (combo box) out of it. I then have to specify which is the popup, toggle button etc. But this causes problem for me because then I can't select individual items as there's no way to define each item, just the popup area. I know I should move the textblocks out of the style and have the developers specify the items, but then I don't get the onMouseOver behavior that I want.

    After snooping the forums for a bit, there seems to be a combo box item style I can edit. Would editing this solve my onMouseOver issues? And if so, does anyone have any xaml code that edits this style just so I can see an example? A link to an existing example would also work. And if this is the way to go as I suspect, is there a way for the developers to switch out the icon in the item easily or should I create a separate style for each item with the appropriate icon?

    Sorry for the total noob question.

    Monday, March 12, 2012 9:10 PM

All replies

  • You will want to go about this the other way you suggested, by editing the template, so all of the states and such work correctly. Are you using WPF or Silverlight?

    Right click your combobox, edit additional templates -> item template -> create empty (or edit current if you have already done this). Now you are editing the template for each of the items in the combobox. You can create the grid + other items you want to see here, including databinding items if your items are generated by the combobox and an items source.

    Monday, March 12, 2012 10:04 PM