Changing format of autocomplete list

6 posts, 0 answers
  1. Jason Gaylord
    Jason Gaylord avatar
    7 posts
    Member since:
    Jan 2007

    Posted 16 Feb 2011 Link to this post

    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?
  2. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 16 Feb 2011 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Jason Gaylord
    Jason Gaylord avatar
    7 posts
    Member since:
    Jan 2007

    Posted 16 Feb 2011 Link to this post

    Makes sense. I see a feature request here. :)
  5. Ivan Todorov
    Admin
    Ivan Todorov avatar
    688 posts

    Posted 21 Feb 2011 Link to this post

    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
  6. Rowen
    Rowen avatar
    13 posts
    Member since:
    Aug 2008

    Posted 21 Apr 2012 Link to this post

    Hi, can you please post the answer or the link to the answer? I cannot find any information on this.
  7. Ivan Todorov
    Admin
    Ivan Todorov avatar
    688 posts

    Posted 24 Apr 2012 Link to this post

    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 >>
Back to Top
UI for WinForms is Visual Studio 2017 Ready