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

Custom Virtualization the GridView

1 Answer 65 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Oleg
Top achievements
Rank 1
Oleg asked on 11 Jan 2013, 03:33 PM
Hello there!

I searched the forum for the solution of my problem, but I didnt find the 100% right thing.
What I have is a GridView with a Column CellTemplate. In that template I built a pretty big custom control, that contains additionally your (telerik) richtextviewer. The purpose of this GridView is - we build a chat view like in Facebook or something - with text in a richtext format, images, hyperlinks etc.

First I tried to use GridView with disabled RowVirtualization. This works great for 0 - 100 items in my collection, but with more it becomes slow, and the loading time is not acceptable. Then I enabled the RowVirtualization and tested it. Fast loading times of the GridView and no problems with large item count in the collection - GridView draws only the items you can see. But the problem here is - while scrolling up and down (many times between the first and the tenth item for example) GridView virtualizes these items and creates and draws them everytime new. This means - scrolling is very laggy, even on my developer PC with i7-2600 CPU, 16GB Ram and SSD drive and NVidia GTX570.

I tried the so called Cells Caching I've found somewhere here in the forums. Tried the VirtualQueryableCollectionView, nothing gives me the performance I need :(

So, what I really need is: A GridView virtualizing offset, that I can set manually. Like a number of items in my collection that will be kept on screen/in memory. For example, if I say I want 100 items not being recycled, then only when I reach the 101th item by scrolling down, the first one will be erased from the cache. That would be perfect for our App.
I didnt find any properties in the GridView that allow me to do such a thing. To achieve it at the moment, I need to write custom code for manually removing top items from the collection when I scroll beyond the 101th item, and also to insert it back, when I scroll back to the top.

I hope you understand what I wanted to say :) I would be happy to get any help here :)

Oleg

1 Answer, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 14 Jan 2013, 09:58 AM
Hi,

I am afraid RadGridView ( or any other ) DataGrid on the market would  not be capable of handling such a heavy cell template.  RadGridView is designed with much lighter templates in mind - e.g. TextBox,TextBlock, combo box  etc. A control like a rich text box may often contain a visual tree with hundreds and even thousands of visuals that need to be taken care off while scrolling.


What I can recommend for your scenario would be:

1. Use a StackPanel to layout the multiple instances of the rich text box
2. Actually use the rich textbox only in edit mode.

In case you insist to use RadGridView for, please use the rich text box only in edit mode . This way you will have just a single instance of the heavy template as only a single cell may be in edit mode at a time.


All the best,
Pavel Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Oleg
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Share this question
or