For example, the .Net CF Listview does not have the AutoResize method on a column. This can be frustrating as to do this manually would be pretty intensive and just un-necessary. There is a solution though, the functionality is still there, it's just hidden away.
If you set the width of the column to be -1, it will resize the column to be the width of the longest item in that column. If you set the width of the column to be -2, it will resize the column to the width of the column heading text.
This is exactly the same as using listView.Columns(0).AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent) and listView.Columns(0).AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize) on the full .Net framework.
Thanks for posting this - was about to begin writing auto width detection code. I completely agree though, while the framework is meant to be slim, some left out things are just silly. No gridlines in listviews, no borders for panels, I could go on and on.
ReplyDeleteMore frustrating is the fact that the functionality is still there in the libs, as most of these can be achieved through pinvokes.
Oh, thank goodness! I can't believe that was it! Whew!!! THANK YOU!
ReplyDelete