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

High Performance RadGridView - Manually Generate Columns

2 Answers 106 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 06 Dec 2016, 06:20 PM
I downloaded the VirtualRadGridView example from here and am setting the VirtualDataSource to a DynamicList class I created that provides records via Load-On-Demand. The DynamicList is a generic list. The VirtualRadGridView is auto generating columns based on properties from the generic type of the DynamicList, even if I set AutoGenerateColumns = false. In the constructor for the RadForm, I'm creating the VirtualRadGridView, clearing the columns, and adding one column. But when the RadForm displays the Grid, it shows the auto-generated columns without the column I added. I found that when the VirtualRadGridView is Initialized, the method InitializeColumns() is called which enumerates all the ItemsSource.BoundProperties and replaces columns starting at index 0. I'm assuming I should insert an if statement to check if AutoGenerateColumns = false and return if so in the InitializeColumns(), but am unsure and wondering if there was a reason the method was designed the way it is or if this was just a simple overlook.

2 Answers, 1 is accepted

Sort by
0
Paul
Top achievements
Rank 1
answered on 06 Dec 2016, 06:49 PM
I went ahead and tried returning within the InitializeColumns() method if AutoGenerateColumns = false, but this didn't work correctly. It didn't auto-generate columns and my manually added column was displayed, but the values loaded were based off VirtualRadGridView.ItemsSource.BoundProperties. I'm unable to determine how BoundProperties is being initialized. BoundProperties is being loaded with four ReflectPropertyDescriptor records related to properties of the DynamicList class's generic type. I need BoundProperties to contain ReflectPropertyDescriptor records for the properties of the DynamicList class's generic type based on the Manually added columns' FieldName properties.
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 07 Dec 2016, 09:30 AM
Hello Paul,

Thank you for writing.  

I would recommend you to use RadVirtualGrid which is a grid component developed on top of Telerik Presentation Framework which provides a convenient way to implement your own data management operations and optimizes the performance when interacting with large amounts of data. You can specify how many columns and rows to be displayed in the grid. The CellValueNeeded event is fired once a cell value is requested. Additional information about populating with data is available here: http://docs.telerik.com/devtools/winforms/virtualgrid/working-with-data/virtualgrid-populating-with-data

Our Demo application >> VirtualGrid examples demonstrate different functionalities that RadVirtualGrid supports.

I hope this information helps. Should you have further questions I would be glad to help.

Regards,
Dess
Telerik by Progress
Telerik UI for WinForms is ready for Visual Studio 2017 RC! Learn more.
Tags
GridView
Asked by
Paul
Top achievements
Rank 1
Answers by
Paul
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or