13 Answers, 1 is accepted
Why not set the ColumnWidth property of RadGridView to star ("*")? You may achieve the same effect through setting the Width of the last column to star.
Vanya Pavlova
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

I would also like to have "some" columns with a fixed width...
Let me try to explain how the ColumnWidth property works in RadGridView.
You may set this property to the following values:
Auto - Automatically fits the size according to content
Fill - Star ("*") - Fills the available space
SizeToHeader - Column width is equal to the width of the header cell
SizeToCells - Column width is equal to the width of the widest (excluding header) cell
# pixels - Sets fixed column width size
Since you have set a fixed witdh for the columns in RadGridView, they would not fit the available space.
I recommend you to use the sizing to achieve the desired result.
Vanya Pavlova
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>


I still experience a problem with column sizes...
I have set a default style MinWidth="100" which applies to all columns.
I set for some columns the Width="*" which works fine, these columns are now auto-stretch/auto-resize to fill the resizable client area.
DockPanel>
<
GridView
>
<
GridViewColumn
Header
=
"Stretch"
Width
=
"*"
/>
<
GridViewColumn
Header
=
"Fixed"
MinWidth
=
"100"
/>
<
GridViewColumn
Header
=
"Stretch"
Width
=
"*"
/>
</
GridView
>
</DockPanel
>
But, at runtime, I can only make the auto-stretch columns larger not smaller...
There must be something else I forget !
Indeed a single star size column cannot be increased/decreased and the behavior is by design. The general approach is to add an additional star size column and then you will be able to resize these columns, please refer to the attached picture. However I am a bit confused by the snippet provided, because everything works fine by my side. The couple of star size columns can be resized and the column between these cannot me smaller than 100 px.
May you please elaborate a bit more about your exact settings?
Vanya Pavlova
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Your reply "Indeed a single star size column cannot be increased/decreased and the behavior is by design." explains the behavior.
Like I mentionned I "can" resize the column, but I can only make it larger, not smaller.
So I guess I can only use the "star" parameter on the rightmost column...
Thanks,
Michel

I am having an issue. My columns won't open all the way and I have ColumnWidth property of RadGridView to star ("*"). I am displaying about 80 fields.
Regards,
Kelly

Thanks.

How do you do this via Code Behind..
I create my RadDataGrids on the fly in codebehind. This "star" code is Read Only and this does not work
myGrid.Columns[myGrid.Columns.Count - 1].Width.IsStar = true;
Thanks, HH

Something like this:
private static void OnColumnWidthChanged(object sender, ColumnWidthChangedEventArgs args)
{
RadGridView grid= sender as RadGridView;
Telerik.Windows.Controls.GridViewColumn gvc = args.Column;
if (grid != null)
{
var rows = grid.ChildrenOfType<
GridViewRow
>();
foreach (GridViewRowItem rowItem in rows)
{
foreach (GridViewCell cell in rowItem.Cells)
{
cell.Column.SetBinding(GridViewColumn.WidthProperty, new Binding("ActualWidth")
{
Source = gvc
});
}
}
}
}
}
Then they will all either adjust once the resize has completed or during the event accordingly. Something like that like I said inside an attached behavior if you are all MVVM else if you are in the code behind just handle the event there if you do not care about MVVM as much, though in theory this is still ok even in MVVM because it is UI update only.


Click the small white arrow on the right side of the grid view and select edit columns
Then click the AutoSizemode under the Layout property and select "Fill"