It seems VB handles listviewColumn.Width = -1, but not C#. So I am redoing my listview column sizing code. These contain HTML and I would like them to be set to the maximum available space of the Listview.
lv.AutoResizeColumn() has no AutoResizeStyle to do available area, so I am trying to do it numerically via extension method.
public static void SetFirstColumnWidthToMax(this Wisej.Web.ListView lv)
{
lv.Columns[0].Width = lv.Width – 24;
}
the problem is, sometimes a vertical scrollbar is showing, and sometimes not — thus I need to account for it. Is there a way to check if the vertical scrollbar is visible? Or is there an easier way to do this? Thanks
Andrew
This is what I have for now. Column height may be different depending on your theme.
public static bool IsVerticalScrollbarOn(this Wisej.Web.ListView lv)
{
//get total row height, if higher than lv.height + column height, return true
int itemHeightTotal = 0;
for (int i =0; i < lv.Items.Count; i++)
{
itemHeightTotal += lv.Items[i].RowHeight;
}
int columnHeight = 33;
int totalHeight = columnHeight + itemHeightTotal;
return totalHeight > lv.Height;
}
Please login first to submit.