ListView weird item height when using TextWrap

6 posts, 1 answers
  1. Igor
    Igor avatar
    145 posts
    Member since:
    Jan 2011

    Posted 24 Jan 2014 Link to this post

    Hi, guys

    i am having issue with ListView items.
    Too large text in the item does not fit into width, please see 001.png.

    it can be solved by setting TextWrap = true for SimpleListViewVisualItem inherited class 

    protected override void SynchronizeProperties()
              Cars car = (Cars)Data.Value;
              this.Text = "<html><br><br><br><br><br><span style=\"color:#141718;font-size:14.5pt;\">" + car.Model + "</span>";
              this.element1.Text = "<html><span style=\"color:#010102;font-size:10.5pt;font-family:Segoe UI Semibold;\">" +
                   "ABS:" + (car.ABS ? "<span style=\"color:#13224D;font-family:Segoe UI;\">YES" : "<span style=\"color:#D71B0E;\">NO") + "</span>" +
                   "<br>ESR:" + (car.ESR ? "<span style=\"color:#13224D;font-family:Segoe UI;\">YES" : "<span style=\"color:#D71B0E;\">NO") + "</span>" + "</span>";
              this.TextAlignment = ContentAlignment.TopLeft;
              this.ImageAlignment = ContentAlignment.TopLeft;
              //this fixes issue from 001.png
             this.TextWrap = true;

    but, i will get the result shown on 002.png, where we have too big item height and second item does not seems to be shown correctly ("Q7" word is not shown).

    I have figured out, if the string length does fit into ListViewItem width, it might miss last word of item text.
    If  I disable images for ListViewItem, then i can see last word  of item text. see image 003.png

      private void listView_ItemDataBound(object sender, ListViewItemEventArgs e)
                //comment this to fix last word showing
                e.Item.Image = (Image)Resources.ResourceManager.GetObject(((Cars)e.Item.Value).ImageFileName);

    anyway, i cannot fix first item height.

    i have checked this one
    but it does not help too much.

    i am using Telerik WinForms version: 2013.2.724.40

    the source code project is available for download here:

    Look forward for your ideas!
    Thank you! 

  2. Igor
    Igor avatar
    145 posts
    Member since:
    Jan 2011

    Posted 24 Jan 2014 Link to this post

    when having TextWrap=true, and item text contains only 1 symbol, then it will not be displayed at all.
    Probably this is a consequence of the thing i've explained in the very start of the topic.
  3. Answer
    Dess | Tech Support Engineer, Sr.
    Dess | Tech Support Engineer, Sr.  avatar
    4166 posts

    Posted 29 Jan 2014 Link to this post

    Hello Igor

    Thank you for contacting Telerik Support.

    In order to obtain correct sizing of the items of the custom items, it is necessary to set ItemSize according to control's size and restructure the custom item to hold the whole information in the stack as it is demonstrated in our Custom items help article. Please find attached the modified sample project.

    I hope this information helps. Should you have further questions, I would be glad to help.

    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  4. Igor
    Igor avatar
    145 posts
    Member since:
    Jan 2011

    Posted 29 Jan 2014 in reply to Dess | Tech Support Engineer, Sr. Link to this post

    Hi Desislava,

    your solution works like a charm!
    Thank you for your great help :)
  5. sreeranga
    sreeranga avatar
    1 posts
    Member since:
    Dec 2015

    Posted 11 Jan 2016 in reply to Dess | Tech Support Engineer, Sr. Link to this post

    i have listview using template in kendo window 


    iam getting problem with long text in listview item  how can i wrap text 

  6. Hristo
    Hristo avatar
    1522 posts

    Posted 14 Jan 2016 Link to this post

    Hi Sreeranga,

    Thank you for writing.

    This forum thread discusses RadListView in WinForms. From you message, I understand that you might be using Kendo UI. In this case please post your question in the Kendo UI Forums.

    Hristo Merdjanov
    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
Back to Top