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

Header Row in AutoCompleteBox DropDown

5 Answers 67 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Glenn
Top achievements
Rank 1
Glenn asked on 29 Mar 2017, 05:23 AM

Is there a way to add a header row to the DropDownItemTemplate in the RadAutoCompleteBox?

5 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 31 Mar 2017, 01:39 PM
Hi Glenn,

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
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Glenn
Top achievements
Rank 1
answered on 03 Apr 2017, 05:29 AM

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

 

 

0
Stefan
Telerik team
answered on 05 Apr 2017, 07:14 PM
Hi 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
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Rory
Top achievements
Rank 1
answered on 01 Apr 2020, 02:03 PM

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!

0
Dinko | Tech Support Engineer
Telerik team
answered on 06 Apr 2020, 09:57 AM

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

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
AutoCompleteBox
Asked by
Glenn
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Glenn
Top achievements
Rank 1
Rory
Top achievements
Rank 1
Dinko | Tech Support Engineer
Telerik team
Share this question
or