This is a migrated thread and some comments may be shown as answers.

AutoSize last column as a GridView property

4 Answers 54 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Murray
Top achievements
Rank 2
Murray asked on 31 Aug 2012, 12:59 PM
Would it be possible to expose a property in the GridView to allow the last column to autosize to available space, yet still be resizable and still show width of content data by default?

I know there is the ability to set the width to "*" but then if the data is too wide for the grid, scrolling to the last column makes the column 0px (as it is the available space left). Also if we autogenerate columns then it is not practical to have this per-column XAML"fix" as the columns aren't declared in XAML or the ViewModel (MVVM).

This seems to be an issue for many users! Here are some of the links I've found on your forums
http://www.telerik.com/community/forums/silverlight/gridview/empty-column-always-added-as-the-last-column-in-radgridview.aspx
http://www.telerik.com/community/forums/silverlight/gridview/extend-last-column.aspx
http://www.telerik.com/community/forums/silverlight/gridview/scrollbar-missing-when-last-column-width-is-set-to.aspx
http://www.telerik.com/community/forums/silverlight/gridview/remove-the-last-null-column.aspx
http://www.telerik.com/community/forums/silverlight/gridview/gettting-extra-column-in-radgridview.aspx
http://www.telerik.com/community/forums/silverlight/gridview/extra-columns-generated.aspx
http://www.telerik.com/community/forums/silverlight/gridview/column-auto-width-issue.aspx
http://www.telerik.com/community/forums/silverlight/gridview/extra-column-at-the-end-of-the-grid.aspx
http://www.telerik.com/community/forums/silverlight/gridview/urgent-extra-column-in-the-radgrid-grid-loosing-out-horizontal-scroll.aspx
http://www.telerik.com/community/forums/silverlight/gridview/upgrading-from-q2-2009-to-q1-2010-empty-column.aspx
http://www.telerik.com/community/forums/silverlight/gridview/grid-view-100-and-autoformatting-columns.aspx
http://www.telerik.com/community/forums/silverlight/gridview/column-width-fit-to-gridview.aspx
http://www.telerik.com/community/forums/silverlight/gridview/resizing-columns.aspx
http://www.telerik.com/community/forums/silverlight/gridview/one-more-column-problem.aspx
http://www.telerik.com/community/forums/silverlight/gridview/also-disable-the-space-not-used-by-the-columns.aspx
http://www.telerik.com/community/forums/silverlight/gridview/rendering-issue-for-column-having-width-and-resize-textwraping-enabled.aspx
http://www.telerik.com/community/forums/silverlight/gridview/how-to-set-gridviewdatacolumn-width-to-fill.aspx
http://www.telerik.com/community/forums/silverlight/gridview/how-to-remove-extra-column.aspx

etc

The other reason the width="*" is not viable is if the user re-orders the column then this "*" size is lost on the new last column, and shrinks the column that it was applied to to 0px wide.

This is quite obviously an issue for most users here and a constant complaint from my QA team and our clients.


4 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 05 Sep 2012, 12:07 PM
Hello,

Adding such a property is not in our immediate development plans but we will have a discussion on how it would fit the existing Width scenarios.
 
Meanwhile, may I ask you to share more details on this line(as it is not clear to me):
"I know there is the ability to set the width to "*" but then if the data is too wide for the grid, scrolling to the last column makes the column 0px."?

Kind regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Murray
Top achievements
Rank 2
answered on 05 Sep 2012, 01:00 PM
http://muzman.net/telerik/TelerikStarWidthGrid.png

In the meantime, I've modified the template so the celss and header cell have no right border and a 1px left border. (Standard is 1px right and 0px left).

This works visually for me as the last column, having no right border, looks like it fills the blank grid area.
0
Dimitrina
Telerik team
answered on 06 Sep 2012, 09:55 AM
Hi,

 Thank you for clarifying. We will discuss this case.

Kind regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Dimitrina
Telerik team
answered on 12 Sep 2012, 01:21 PM
Hi,

We have discussed your suggestion and the scenario with the too small last column. It seems that you have set fixed Width for the GridView and the rest of the columns, so the last column will be shown with a minimum Width.
I have checked the behaviour with the MS DataGrid and actually it is the same. We have done our rendering mechanisms to be synchronous with the DataGrid and currently we do not have plans to change that behaviour. 

You can set a larger Width for the GridView or leave it with Auto Width so that the last column can take all the space it needs.

All the best,
Didie
the Telerik team

Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

Tags
GridView
Asked by
Murray
Top achievements
Rank 2
Answers by
Dimitrina
Telerik team
Murray
Top achievements
Rank 2
Share this question
or