G
Guest
I am writing an application for the Pocket PC and I am using Compact Framework 1.1. I have a Listview that I am populating with data. I need each column to automatically size itself to the longest piece of data in the column. The documentation says the following.
"The ColumnHeader can be set to adjust at run time to the column contents or heading. To adjust the width of the longest item in the column, set the Width property to -1. To autosize to the width of the column heading, set the Width property to -2."
This doesn't work properly. If I set the Column widths AFTER populating the data, the columns totally disappear (if I set it to -1 or -2).
So, I then tried setting the column widths to -1 or -2 upon creation of the Column Headers. In either case (setting to -1 or -2), the same result is produced, which is autosizing the columns to their HEADER size. I need to autosize to the DATA in that column.
I have noticed that if I double tap on the edge of each header, it correctly resizes that column to the width of the data it contains.
How can I get around this? I need to autosize to the data size, not the column header text. Is there a way I can "fake" a double tap on each column when I am done populating the data?
Thanks in advance!
"The ColumnHeader can be set to adjust at run time to the column contents or heading. To adjust the width of the longest item in the column, set the Width property to -1. To autosize to the width of the column heading, set the Width property to -2."
This doesn't work properly. If I set the Column widths AFTER populating the data, the columns totally disappear (if I set it to -1 or -2).
So, I then tried setting the column widths to -1 or -2 upon creation of the Column Headers. In either case (setting to -1 or -2), the same result is produced, which is autosizing the columns to their HEADER size. I need to autosize to the DATA in that column.
I have noticed that if I double tap on the edge of each header, it correctly resizes that column to the width of the data it contains.
How can I get around this? I need to autosize to the data size, not the column header text. Is there a way I can "fake" a double tap on each column when I am done populating the data?
Thanks in advance!