Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ListViewItem text truncated after selection - Compact Framework

I have a ListView with some ListViewItems (only text).

listView1 = new ListView
{
    View = System.Windows.Forms.View.Details,
    HeaderStyle = ColumnHeaderStyle.None
};


listView1.Columns.Add(String.Empty, -2, HorizontalAlignment.Left);

The following image is an example:

enter image description here

The problem is that when I select one of these items the text is truncated, like in the following image:

enter image description here

Why? How can I solve this problem?

like image 565
Nick Avatar asked Mar 20 '13 16:03

Nick


Video Answer


1 Answers

The problem is that the Text of your ListViewItem ends with empty spaces. You have to TrimEnd the string and you have your solution.

like image 70
gliderkite Avatar answered Oct 08 '22 14:10

gliderkite