+2009-10-23 Carlos Alberto Cortez <calberto.cortez@gmail.com>
+
+ * ColumnHeader.cs: When calculating the width and height of the
+ column, try to expand to the right and use all the free space if we
+ are the last column *and* the resize mode is set to -2/header content.
+ Fixes #544716.
+
2009-10-14 Carlos Alberto Cortez <calberto.cortez@gmail.com>
* ListView.cs: When retrieving the top item, take into account the
else
column_rect.Height = ThemeEngine.Current.ListViewGetHeaderHeight (null, ThemeEngine.Current.DefaultFont);
- if (width >= 0)
+ column_rect.Width = 0;
+
+ if (width >= 0) // manual width
column_rect.Width = width;
- else if (Index != -1) {
+ else if (Index != -1) { // automatic width, either -1 or -2
+ // try to expand if we are the last column
+ bool expand_to_right = Index == owner.Columns.Count - 1 && width == -2;
+ Rectangle visible_area = owner.ClientRectangle;
+
column_rect.Width = owner.GetChildColumnSize (Index).Width;
width = column_rect.Width;
- } else
- column_rect.Width = 0;
+
+ // expand only if we have free space to the right
+ if (expand_to_right && column_rect.X + column_rect.Width < visible_area.Width) {
+ width = visible_area.Width - column_rect.X;
+ if (owner.v_scroll.Visible)
+ width -= owner.v_scroll.Width;
+
+ column_rect.Width = width;
+ }
+ }
}
internal void SetListView (ListView list_view)