Wrap Text in a RadAutoComplete

2 posts, 1 answers
  1. Thomas
    Thomas avatar
    7 posts
    Member since:
    Aug 2014

    Posted 04 Jun 2015 Link to this post

    We are having an issue where the results are wider than the available area on the RadAutoCompleteBox. If it is too wide, it adds the ellipses (...). We would prefer it wrap. I tried programmatically setting the radAutoCompleteBox.ListItem.TextWrap to true, but there was no effect. How can I make the text in the drop down wrap?
  2. Answer
    Ralitsa
    Admin
    Ralitsa avatar
    176 posts

    Posted 09 Jun 2015 Link to this post

    Hi Thomas,

    Thank you for contacting us. 

    You need to set the AutoSizeItems property to true of RadAutoCompleteBox.ListElement and the TextWrap property to true. Here is а code snippet: 
    this.radAutoCompleteBox1.ListElement.AutoSizeItems = true;
    RadAutoCompleteBoxListElement le = this.radAutoCompleteBox1.ListElement as RadAutoCompleteBoxListElement;
    le.VisualItemFormatting+=le_VisualItemFormatting;
     
    //handler of VisualItemFormatting
    void le_VisualItemFormatting(object sender, VisualItemFormattingEventArgs args)
    {
        args.VisualItem.TextWrap = true;
    }

    You can also refer to the attached sample demo. 

    Hope this will help you. Let me know if you have any other questions.

    Regards,
    Ralitsa
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top