I'm getting an extra column at the end of my grid when I resize the container.
Reading the posts, I note that one way that I should be able to remove this extra column is by setting the width of the last column to fill (i.e. "*").
However, I am using an ObsevableCollection of GridViewDataColumns to generate the columns of my grid.
How do I set the width of the a GridViewDataColumn to fill. Width takes a value of type GridViewLength which only have 3 options (i.e. Auto, SizeToCells, SizeToHeader) of which the default is Auto.
Thanks,
Tony
6 Answers, 1 is accepted
You could set the width to "*" like so:
column.Width =
new
GridViewLength(1, GridViewLengthUnitType.Star);
Please let me know if this is what you need.
Didie
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Regards,
Tony

<telerik:GridViewDataColumn DataMemberBinding="{...}" Header="{...}" IsReadOnly="True" Width="*"/>
But this causes strange behavior when the user drags to resize the column headers of other cells next to the stretched column. Any other way of achieving column stretch of a specific column without destroying column resize behaviour?
Generally if you have a column with Width="*", then you should be able to still re-size any of the columns. Would you please share more details or a demo project on this strange behavior you experience?
Regards,
Didie
Telerik

Hello,
I think we are experiencing the same stringe behavior as Erlend.
It can be simulated with your WPF Controls Examples application: GridView Examples, Example 'Custom Sorting'.
When there is a combination of columnwidth Auto and *, the resizing is strange:
- Trying to make the columns City, Country or Phone larger fails and other columns collapse
- Trying to extend the company name results into flickering
We would like to have the following behavior:
- If there are too many columns, a horizontal scrollbar should appear (this is probably not possible with star column width?)
- When resizing, only the current column should resize
- When there are few columns, they should stretch to fill the full grid width
The closest I get is to set all column widths to auto, then the first 2 issues are handled.
Is there a possibility to handle all issues?
As it turns out I cannot suggest you a solution to achieve all three points. Currently, we have an issue logged into our system regarding:
After column with width=* is resized to it's minimum width, it cannot be resized to a larger width.
Still, this issue is still not resolved.
Regards,
Dimitrina
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.