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

Changing format of autocomplete list

5 Answers 122 Views
ListControl
This is a migrated thread and some comments may be shown as answers.
Jason Gaylord
Top achievements
Rank 1
Jason Gaylord asked on 16 Feb 2011, 04:33 PM
I've changed the look and feel of the normal dropdownlist by handling the VisualListItemFormatting event. However, how can I change the look of the items shown when using autocomplete?

5 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 16 Feb 2011, 04:39 PM
Hi,

As far as I know, this is not possible as the textbox item part of the drop down is the same as the RadTextBox.. Have a look at my answer in this forum post for more information.
Richard
0
Jason Gaylord
Top achievements
Rank 1
answered on 16 Feb 2011, 04:40 PM
Makes sense. I see a feature request here. :)
0
Ivan Todorov
Telerik team
answered on 21 Feb 2011, 12:59 PM
Hello Jason,

You can find the answer to your question in the ticket which concerns the same topic.

Best wishes,
Ivan Todorov
the Telerik team
0
Rowen
Top achievements
Rank 1
answered on 22 Apr 2012, 03:19 AM
Hi, can you please post the answer or the link to the answer? I cannot find any information on this.
0
Ivan Todorov
Telerik team
answered on 24 Apr 2012, 02:36 PM
Hello Rowen,

Thank you for writing.

You can handle the PopupOpened event and the VisualItemFormatting event to change the look and feel of the items. The following code snippet demonstrates this:
radDropDownList1.DropDownListElement.AutoCompleteSuggest.DropDownList.VisualItemFormatting += new VisualListItemFormattingEventHandler(DropDownList_VisualItemFormatting);
  
radDropDownList1.DropDownListElement.AutoCompleteSuggest.DropDownList.PopupOpened += new EventHandler(DropDownList_PopupOpened);
  
void DropDownList_PopupOpened(object sender, EventArgs e)
{
            foreach (RadListVisualItem item in ((RadDropDownListElement)sender).ListElement.ViewElement.Children)//loop troughs visual items
            {
                item.BackColor = Color.Red;
            }
}
  
void DropDownList_VisualItemFormatting(object sender, VisualItemFormattingEventArgs args)
{
            args.VisualItem.BackColor = Color.Red;
            Debug.WriteLine(args.VisualItem.Text);
}

Hope this helps. Should you have any further questions, feel free to ask.

All the best,
Ivan Todorov
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Tags
ListControl
Asked by
Jason Gaylord
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Jason Gaylord
Top achievements
Rank 1
Ivan Todorov
Telerik team
Rowen
Top achievements
Rank 1
Share this question
or