Programmatic Grouping & Virtualization throws an exception

1 posts, 0 answers
  1. Christian
    Christian avatar
    2 posts
    Member since:
    Sep 2012

    Posted 04 Sep 2012 Link to this post

    Hi,

    I'm using v4.0.30319  and Silverlight 5.
    I fill a gridView with many records using VirtualQueryableCollectionView, after the user clicks a button the system must group the data list, (as when the user drags and drops the column into the group panel), so I create a GroupDescriptor and add it to the radGridView collection of GroupDescriptors, but Telerik control throws the following exception:

    {System.ArgumentNullException: Value cannot be null.
    Parameter name: body
       at System.Linq.Expressions.Expression.Lambda(Expression body, String name, Boolean tailCall, IEnumerable`1 parameters)
       at System.Linq.Expressions.Expression.Lambda(Expression body, ParameterExpression[] parameters)
       at Telerik.Windows.Data.Expressions.GroupDescriptorExpressionBuilder.CreateGroupKeySelectorExpression()
       at Telerik.Windows.Data.Expressions.GroupDescriptorExpressionBuilder.get_GroupKeySelectorExpression()
       at Telerik.Windows.Data.Expressions.GroupDescriptorExpressionBuilderBase.CreateQuery()
       at Telerik.Windows.Data.Expressions.GroupDescriptorCollectionExpressionBuilder.CreateChildQuery(GroupDescriptorExpressionBuilder childBuilder)
       at Telerik.Windows.Data.Expressions.GroupDescriptorCollectionExpressionBuilder.CreateQuery()
       at Telerik.Windows.Data.QueryableExtensions.GroupBy(IQueryable source, IEnumerable`1 groupDescriptors)
       at Telerik.Windows.Data.VirtualQueryableCollectionView.CreateView()
       at Telerik.Windows.Data.QueryableCollectionView.get_QueryableView()
       at Telerik.Windows.Data.VirtualQueryableCollectionView.get_InternalList()
       at Telerik.Windows.Data.QueryableCollectionView.EnsureRootGroup()
       at Telerik.Windows.Data.QueryableCollectionView.get_Groups()
       at Telerik.Windows.Controls.GridView.GridViewItemContainerGenerator.PrepareGrouping()
       at Telerik.Windows.Controls.GridView.GridViewItemContainerGenerator.ResetGeneratorAndReuseContainers()
       at Telerik.Windows.Controls.GridView.GridViewItemContainerGenerator.ReInitializeContainers()
       at Telerik.Windows.Controls.GridView.GridViewDataControl.ReuseContainersOnReset()
       at Telerik.Windows.Controls.GridView.GridViewDataControl.OnItemsChanged(NotifyCollectionChangedEventArgs e)
       at Telerik.Windows.Controls.GridView.BaseItemsControl.OnItemCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
       at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
       at Telerik.Windows.Data.DataItemCollection.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
       at Telerik.Windows.Data.DataItemCollection.OnCollectionViewCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
       at Telerik.Windows.Data.Listener`2.ReceiveWeakEvent(Object sender, TArgs args)
       at Telerik.Windows.Data.WeakEvent.WeakListener`1.Handler(Object sender, TArgs args)
       at Telerik.Windows.Data.QueryableCollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args)
       at Telerik.Windows.Data.VirtualQueryableCollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args)
       at Telerik.Windows.Data.QueryableCollectionView.RefreshOverride()
       at Telerik.Windows.Data.QueryableCollectionView.RefreshInternal()
       at Telerik.Windows.Data.QueryableCollectionView.RefreshOrDefer()
       at Telerik.Windows.Data.QueryableCollectionView.InvalidatePagingAndRefresh()
       at Telerik.Windows.Data.VirtualQueryableCollectionView.InvalidatePagingAndRefresh()
       at Telerik.Windows.Data.QueryableCollectionView.OnGroupDescriptorsCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
       at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
       at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
       at Telerik.Windows.Data.RadObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
       at Telerik.Windows.Data.ObservableItemCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
       at System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, T item)
       at Telerik.Windows.Data.RadObservableCollection`1.InsertItem(Int32 index, T item)
       at System.Collections.ObjectModel.Collection`1.Insert(Int32 index, T item)
       at System.Collections.ObjectModel.Collection`1.System.Collections.IList.Insert(Int32 index, Object value)
       at Telerik.Windows.Data.CollectionHelper.Insert(IList target, IEnumerable newItems, Int32 startingIndex, IEqualityComparer itemComparer)
       at Telerik.Windows.Data.ObservableCollectionManager.HandleCollectionChanged(IList sender, NotifyCollectionChangedEventArgs args)
       at Telerik.Windows.Data.ObservableCollectionManager.Telerik.Windows.Data.IWeakEventListener<System.Collections.Specialized.NotifyCollectionChangedEventArgs>.ReceiveWeakEvent(Object sender, NotifyCollectionChangedEventArgs args)
       at Telerik.Windows.Data.WeakEvent.WeakListener`1.Handler(Object sender, TArgs args)
       at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
       at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
       at Telerik.Windows.Data.RadObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
       at Telerik.Windows.Data.ObservableItemCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
       at System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, T item)
       at Telerik.Windows.Data.RadObservableCollection`1.InsertItem(Int32 index, T item)
       at System.Collections.ObjectModel.Collection`1.Add(T item)
       at DemoTelerik.DemoGrid.Button_Click(Object sender, RoutedEventArgs e)
       at System.Windows.Controls.Primitives.ButtonBase.OnClick()
       at System.Windows.Controls.Button.OnClick()
       at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
       at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
       at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName, UInt32 flags)}


    This is part of my code:
    GroupDescriptor descriptor = new GroupDescriptor();
    descriptor.Member = "ProductID";
    descriptor.SortDirection = ListSortDirection.Ascending;
    descriptor.DisplayContent = "Product";

    RadGridView1.GroupDescriptors.Add(descriptor);    // the exception is thrown here

    Note: If I don't use VirtualQueryableCollectionView, the system works perfectly.


Back to Top