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

WPF RadGridView Resize All Columns on bound data change

3 Answers 218 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Anvarbek
Top achievements
Rank 1
Anvarbek asked on 08 Dec 2011, 06:41 PM
Hi,

I am using WPF Telerik RadGridView control (2011.2.920.35) .

I have simple View (with navigation tree on the left and grid on the right which displays data with number of columns) (using MVVM).

When I change the tree node on the left, it should update with data in the grid.  It updates the data fine, but how can I force all columns to resize to fit content as data changes or user might have resized the columns for the previous data ?

I need an example of the code which I can programmatically to resize all columns to "fit to content".

Let me know if you want any other specific details.


3 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 09 Dec 2011, 08:09 AM
Hello,

 You need to set these columns Width to Auto.

Regards,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Anvarbek
Top achievements
Rank 1
answered on 09 Dec 2011, 10:15 AM
Hi Vlad,

 I have tried that before, if the user changes the column with manully then it doesnt resize when I reload with new data.

Is it possible to force grid to re-draw the layout based on new data?
0
Vlad
Telerik team
answered on 14 Dec 2011, 07:39 AM
Hi,

 Usually the grid will redraw itself if you change ItemsSource. You do not need to do anything special. 

Best wishes,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Anvarbek
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Anvarbek
Top achievements
Rank 1
Share this question
or