This is a migrated thread and some comments may be shown as answers.

Headers for Combo

3 Answers 55 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Kevin Blanton
Top achievements
Rank 1
Kevin Blanton asked on 05 Mar 2010, 04:52 PM
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

3 Answers, 1 is accepted

Sort by
0
Konstantina
Telerik team
answered on 09 Mar 2010, 05:08 PM
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.
0
Kevin Blanton
Top achievements
Rank 1
answered on 12 Mar 2010, 08:18 PM
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
0
Accepted
Konstantina
Telerik team
answered on 18 Mar 2010, 10:59 AM
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.
Tags
ComboBox
Asked by
Kevin Blanton
Top achievements
Rank 1
Answers by
Konstantina
Telerik team
Kevin Blanton
Top achievements
Rank 1
Share this question
or