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

Load on Demand

1 Answer 63 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Raul asked on 28 Dec 2015, 01:44 PM


 I'm currently testing the RadGridView with Load On Demand behaviour and I'm having some issues.


I'm using Entity Framework and when grouping the GridView the rows within some groups appear twice. This happens sometime just after opening the groups but sometimes not until clicking on the row within the group. Then a second row appears within that group.

This only happens when using VirtualQueryableCollectionView as ItemsSource of the GridView. When using ObservableCollection everything is ok. It's also in both cases ok, when no grouping is used - also when removing the grouping after having the duplicated rows. The affected groups are mostly those displayed at the top of the gridview. When changing the sort order of the column before grouping the column, the groups with duplicated rows are at the bottom.


using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Telerik.Windows.Controls;
using Telerik.Windows.Data;
using GalaSoft.MvvmLight.Messaging;
namespace PsShell.ViewModels.Articles.CtlArticleMainSelection {
    public class ArticleMainSelectionViewModel : ViewModelBase {
        public delegate ArticleMainSelectionViewModel Factory();
        public ArticleMainSelectionViewModel() {
         private PsShell.Models.Articles.CtlArticleMainSelection.ArticleModel _selectedArticle = null;
        public PsShell.Models.Articles.CtlArticleMainSelection.ArticleModel SelectedArticle {
            get {
                return _selectedArticle;
            set {
                _selectedArticle = value;
//        private ObservableCollection<Models.Articles.CtlArticleMainSelection.ArticleModel> _articles = null;
//        public ObservableCollection<Models.Articles.CtlArticleMainSelection.ArticleModel> Articles {
        private VirtualQueryableCollectionView _articles = null;
        public VirtualQueryableCollectionView Articles {
            get {
                if (_articles == null) {
                    var context = new Models.Articles.CtlArticleMainSelection.ArticleContext();
                    var query = from gp in context.BusinessPartner
                                orderby gp.geschaeftspartner_id ascending
                                select new Models.Articles.CtlArticleMainSelection.ArticleModel() {
                                    Name1 = gp.Name1,
                                    Name2 = gp.Name2
                    _articles = new VirtualQueryableCollectionView(query) { LoadSize = 50, VirtualItemCount = 150 };    // duplicate row in group
//                    _articles = new ObservableCollection<Models.Articles.CtlArticleMainSelection.ArticleModel>(query); // ok
                return _articles;


<UserControl x:Class="PsShell.Views.Articles.CtlArticleMainSelectionView"
             d:DesignHeight="800" d:DesignWidth="1400">
      <DockPanel LastChildFill="True">
        <telerik:RadGridView x:Name="gvArticles" ItemsSource="{Binding Articles}" SelectedItem="{Binding SelectedArticle, Mode=TwoWay}"
                             IsReadOnly="True" EnableRowVirtualization="True" EnableColumnVirtualization="True"
                             AutoGenerateColumns="False" ShowGroupPanel="True" GroupRenderMode="Flat"
                             IsSynchronizedWithCurrentItem="True" SelectionMode="Single"
                             FilteringMode="FilterRow" ScrollMode="RealTime">
                <telerik:ColumnSortDescriptor Column="{Binding Columns[\Name1\], ElementName=gvArticles}" SortDirection="Ascending"/>
                <telerik:GridViewDataColumn Header="Name" DataMemberBinding="{Binding Name1}" Width="400" ShowDistinctFilters="False"/>
                <telerik:GridViewDataColumn Header="Namenszusatz / Vorname" DataMemberBinding="{Binding Name2}" Width="300" ShowDistinctFilters="False"/>


A second issue is the performance. When using ObservableCollection as ItemsSource the performance is ok. But when using VirtualQueryableCollectionView the performance is unacceptable slow. I can see the empty grid for about 2 seconds before it is populated with data - and this with a Loadsize of 50 items (in this example it's a bit faster because I reduced the columns from about 10 to 2). I noticed that when using GroupRenderMode="Nested" the performance is noticeable faster, but that isn't the recommended way because of performance issues when using nested grouping.


Best Regards


1 Answer, 1 is accepted

Sort by
Telerik team
answered on 30 Dec 2015, 05:01 PM

Data Virtualization of group items is not fully supported and that is the reason why RadGridView behaves strangely when you try to group it. The idea of the data virtualization is to load only a necessary data but RadGridView grouping scenario should have all. Here you can find some more info about the data virtualization's limitations.

I hope that this helps. Should you have any other questions, do not hesitate to contact us.

Martin Vatev
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question