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

Column Not Auto Sizing Correctly

1 Answer 34 Views
GridView
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 04 Jan 2010, 07:27 AM

Hello,

I have a problem with a column that has its width set to Auto where the column is not sizing to the width of its cell contents. (see attached screen shot)

My GridView is loaded within a View and injected into another container control (i.e. Region) with data from a Web Service.

It only occurs intermittently and only when data is loaded in asynchronously from a web service. If I mock the data locally and load a collection in as the View is being created then the problem does not occur. Very strange!

I have uploaded a demo project you can use to reproduce the issue (it can take anywhere from the first load to fifteen attempts before the sizing issue appears).
http://cid-47007997392d2bb4.skydrive.live.com/self.aspx/.Public/ColumnAutoSizeProblem.zip?lc=5129

Unfortunately setting a fixed with on this column is not an option, it really needs to be auto sized to the contents of the largest cell.

Help appreciated,
James.

1 Answer, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 05 Jan 2010, 09:41 AM
Hi James,

You can call UpdateLayout() for the grid. Here is an example:

void dt_Tick(object sender, System.EventArgs e) {
            // Load in the mocked data and stop the timer.
            view.radGridViewMain.ItemsSource = people;
            view.radGridViewMain.UpdateLayout();
            dt.Stop();            
        }


All the best,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
James
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Share this question
or