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

Column.ActualSize problem

3 Answers 48 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 14 Jun 2018, 09:52 PM

     Hello,

 

When I look at Column.ActualSize for a GridViewColumn I get the correct size for all column except for columns that aren't in view (horizontally). Is there a way I can force the column to resize based on SizeToCells programatically? 

 

3 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 15 Jun 2018, 04:17 PM
Hi Paul,

This behavior would be the expected one, as RadGridView utilizes UI virtualization for both its rows and columns. Thus, the columns are measured only when they are brought into the viewport. Prior that their ActualWidth property will have the default value of 20px. Can you please share some details on the need to have the ACtualWidth value?

Regards,
Stefan
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Paul
Top achievements
Rank 1
answered on 15 Jun 2018, 06:09 PM

Hi Stefan,

I just figured that out before seeing your post. I turned off column virtualization and it is working for my purposes.

The reason I need to have the ActualWidth value is because I am writing custom printing code. I want my columns on my printed page to match the width of the data within the cells. The GridView already does this with the SizeToCells mode on a column. 

For now turning off ColumnVirtualization works for me. It would be nice to explicitly update a column so I don't lose the benefits of column virtualization though. 

 

0
Stefan
Telerik team
answered on 20 Jun 2018, 11:15 AM
Hi Paul,

Thank you for this clarification.

Forcing the column to measure itself without being brought into the viewport would basically mean interfering with the column virtualization of RadGridView. I am afraid that this would not be possible. It seems that disabling the column virtualization would be the only solution for such specific requirement. Please note, that generally we highly recommend not to disable the UI virtualization.

Regards,
Stefan
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
GridView
Asked by
Paul
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Paul
Top achievements
Rank 1
Share this question
or