Headers for Combo

4 posts, 1 answers
  1. Kevin Blanton
    Kevin Blanton avatar
    9 posts
    Member since:
    Sep 2012

    Posted 05 Mar 2010 Link to this post

    I have a combobox that I have setup to have multiple columns using the itemtemplate.

    I need to add a header that stays at the top of the combo.  I have researched this in the forms here and the suggestions seems to be to use the dropdownbutton control and embed a gridview.  I can not use this approach because our user MUST be able to enter text into the combo without opening it if they wish.

    I have seen the suggestion of using create custom ComboBox style but I have not seen an example of how to use this approach.

    Does anyone have an example of this approach?

    I have also seen an example of embedding a gridview into the combo, but every one of these examples seems to be REALLY complex.
    If there is a simple way to do this I would like to see this as well.

    Any help would be appreciated.

    Kevin

  2. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 09 Mar 2010 Link to this post

    Hello Kevin,

    Thank you for contacting us.

    You can achieve that by editing the style of the ComboBox. The easiest way to do that is to drop a RadComboBox in the Blend Expression design surface and right-click it, choose from the menu Edit Template->Edit a Copy. Then in the NonEditableComboBox and EditableComboBox ControlTemplates add a Grid with some columns and TextBlocks in it. This will play the role of the header. After that edit the Item's DataTemplate to look like this Grid.
    Attached you will find a sample project in which that is illustrated.

    If you have further questions please feel free to contact us again.

    Regards,
    Konstantina
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. DevCraft banner
  4. Kevin Blanton
    Kevin Blanton avatar
    9 posts
    Member since:
    Sep 2012

    Posted 12 Mar 2010 Link to this post

    Hi Konstantina,

    Thanks for the example.  This is working great.   However, I do have one last issue that I'm hoping you can help me with.

    I have embedded a combo into a RadGrid and it is working as expected.  The challenge that I have is there is another column in the row that changes which columns should show up in the combobox.

    For example, there is a choice for prepaid or collect in another column.  If the user chooses prepaid,I need to show columns in the combo for Acct Code, Name, Credit Limit, etc.... If the user chooses collect, I need to show Acct Code, Name, Address, City, etc...

    In both instances we are allowing the user to select an account code, but we need to show different info in the other columns in order to help the user choose the proper code.

    Is it possible to change the style or template on the fly in the DropDownOpened or GotFocus event?

    Any insight that you can provide here would be appreciated.

    Kevin
  5. Answer
    Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 18 Mar 2010 Link to this post

    Hello Kevin,

    Thank you for contacting us.

    Attached you will find a sample project which illustrates how you can change the style of the ComboBox according to the selected item of another ComboBox. You can modify the example to fit your scenario.

    Hope this helps.

    If you have further questions please feel free to contact us again.

    All the best,
    Konstantina
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top