Listview.ColumnHeader.Width = -1 or -2 does not work in other languages?

Hi,

When running code that works perfectly fine in an English installation of the .NET Compact Framework under a different language (in this case German and Swedish) - setting the ListView.ColumnHeader property to -1 or -2 does not work at all!

The code below when run with breakpoints in the code NEVER returns ch.Width as anything but ZERO.

// auto-size columns
foreach (ColumnHeader ch in listView.Columns)
{
// try setting width by column header text
ch.Width = -2;
int w = ch.Width;
// now try longest item text
ch.Width = -1;
// is this wider than the column title
if (ch.Width < w)
{
// no - then use the column title width
ch.Width = w;
}
}

Has anyone else experienced this, it can be reproduced using a German Pocket PC emulator image, I realise I may need to workaround with the listsheet graphics object, but I would just like to know that I'm not going mad on this one.

Regards,

Rob


Answer this question

Listview.ColumnHeader.Width = -1 or -2 does not work in other languages?