5 Answers, 1 is accepted
Generally, you should be able to define whatever element you need in the DropDownItemTemplate of the control. For example, if you follow the approach demonstrated in the Customizing the DropDownItem Template topic, you can simply define a TextBlock element above the Grid container that would serve as a header. Would such an approach be feasible for you or I am missing something?
Regards,
Stefan X1
Telerik by Progress
Hi Stefan,
Everything in the DropDownItemTemplate is repeated for each row of bound data, so any header row I create there is repeated with each row of the data. What I would like is a single header row, with datarows repeated below it.
I tried adding a textblock above the grid container as you suggested, but wasn't able to do so (the datatemplate only allows one item in the "visualtree").
Regards,
Glenn
Indeed, the element cannot be added in the DataTemplate directly. You will need to add an additional container wrapping all elements in it. For example, a StackPanel or a Grid.
Can you please give it a try?
Best Regards,
Stefan X1
Telerik by Progress
Hi Stefan & Glenn,
Was this ever solved? I am trying to do the same thing but am getting a header for every row. We want just one header.
Thanks!
Hi Rory,
If you want to add a header element inside the drop-down part of the RadAutocompeteBox control you will have to extract and edit the default template of the control. In your case, after you have extracted the default template of the control, you will need to navigate to the Popup element inside the template and modify its content by adding a TextBlock which represents your header. You can place it able the RadListBox control.
I hope this approach is helpful.
Regards,
Dinko
Progress Telerik
Our thoughts here at Progress are with those affected by the outbreak.