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

[Solved] New Column Width Modes in RadGridView for Silverlight

0 Answers 749 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Telerik Admin
Top achievements
Rank 1
Iron
Telerik Admin asked on 08 Dec 2009, 10:34 AM
Following our practice to highlight the most frequently asked questions, here we add details regarding the latest properties for managing the column width size introduced with Q3 2009 release.

The table below demonstrates which new modes substitute the obsolete ones. The table provides and short descriptions how the new modes affects the column width. Consider the table when upgrading from Q2 2009 to Q3 2009 release or when you arrange your grid view.


ColumnWidthMode (Obsolete) ColumnWidth Description
Auto Auto (Default Value) 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


The ColumnWidth property will set width to autogenerated columns once when they are generated. Changes made to this property after the creation of the autogenerated columns will not affect them.

Here is a code example:
private void chkExpandColumns_Click(object sender, RoutedEventArgs e)
 {
     if (this.chkExpandColumns.IsChecked == true)
     {
         this.gvwWorkList.ColumnWidth = GridViewLength.Auto;
     }
 
     if (this.chkExpandColumns.IsChecked == false)
     {
         this.gvwWorkList.ColumnWidth = new GridViewLength(1, GridViewLengthUnitType.Star);
     }
 }


Also the width property can be set to a single column. It is of the same type and it supports the same values as ColumnWidth on RadGridView.

Note that if there is “*” column in the grid then column virtualization will be off. For more details please have a look at this forum post.
Tags
GridView
Asked by
Telerik Admin
Top achievements
Rank 1
Iron
Share this question
or