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

sorting columns of grouped elements of dynamic objects

1 Answer 104 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Karin
Top achievements
Rank 2
Karin asked on 20 Jul 2011, 03:04 PM
Hello!
In my application I am trying to sort columns of grouped dynamic objects (e.g. implementing IDynamicMetaObjectProvider). It works fine until I try to sort a column of a grouped list, throwing a null exception in private static IEnumerable<PropertyDescriptor> GetPropertyDescriptorsForDynamicType(QueryableCollectionView collectionView) in ItemPropertyInfoHelper.cs:

Telerik.Windows.Data.dll!Telerik.Windows.Data.ItemPropertyInfoHelper.GetPropertyDescriptorsForDynamicType(Telerik.Windows.Data.QueryableCollectionView collectionView) Line 184 + 0x30 bytes    C#
Telerik.Windows.Data.dll!Telerik.Windows.Data.ItemPropertyInfoHelper.GetPropertyDescriptors(Telerik.Windows.Data.QueryableCollectionView collectionView) Line 86 + 0x1a bytes    C#
Telerik.Windows.Data.dll!Telerik.Windows.Data.ItemPropertyInfoHelper.CreateItemProperties(Telerik.Windows.Data.QueryableCollectionView collectionView) Line 41 + 0xa bytes    C#
Telerik.Windows.Data.dll!Telerik.Windows.Data.QueryableCollectionView.GetItemProperties() Line 38 + 0xa bytes    C#
Telerik.Windows.Data.dll!Telerik.Windows.Data.QueryableCollectionView.ItemProperties.get() Line 29 + 0x14 bytes    C#
Telerik.Windows.Data.dll!Telerik.Windows.Data.DataItemCollection.ItemPropertiesAreDifferent(Telerik.Windows.Data.QueryableCollectionView newCollectionView, Telerik.Windows.Data.QueryableCollectionView oldCollectionView) Line 216 + 0x35 bytes    C#
Telerik.Windows.Data.dll!Telerik.Windows.Data.DataItemCollection.CollectionView.set(Telerik.Windows.Data.QueryableCollectionView value) Line 103 + 0x16 bytes    C#
Telerik.Windows.Data.dll!Telerik.Windows.Data.DataItemCollection.CreateAndSetCollectionView(System.Collections.IEnumerable source) Line 932 + 0x3a bytes    C#
Telerik.Windows.Data.dll!Telerik.Windows.Data.DataItemCollection.SetItemsSource(System.Collections.IEnumerable source) Line 713    C#
Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.GridViewDataControl.Bind.AnonymousMethod__17() Line 3646    C#
Telerik.Windows.Controls.dll!Telerik.Windows.Controls.CursorManager.PerformTimeConsumingOperation(System.Windows.FrameworkElement frameworkElement, System.Action action) Line 16 + 0xf bytes    C#
Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.GridViewDataControl.Bind(object newValue) Line 3675    C#
Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.GridViewDataControl.OnItemsSourceChanged(object oldValue, object newValue) Line 3267 + 0x15 bytes    C#
Telerik.Windows.Data.dll!Telerik.Windows.Controls.DataControl.OnItemsSourcePropertyChanged(System.Windows.DependencyObject origin, System.Windows.DependencyPropertyChangedEventArgs args) Line 144    C#

The problem is that GetPropertyDescriptorsForDynamicType accesses the first element in the collectionview and tries to cast it to an IDynamicMetaObjectProvider:

var dynamicObject = collectionView.ElementAt(0) as System.Dynamic.IDynamicMetaObjectProvider;
var metaObject = dynamicObject.GetMetaObject(System.Linq.Expressions.Expression.Constant(dynamicObject));

When grouping the first element is of type AggregateFunctionsGroup and not of Type ElementType (which made the code branch into this function in the first place). To get the correct dynamic object, the line would have to be changed to get the first element of the first group that has elements but no children (or something similiar)..

I could use an ITypedList in order to not branch into GetPropertyDescriptorsForDynamicType, but it should work this way as well.
I have tried the latest internal build, but the problem remains.
Can you reproduce this problem?
Kind Regards,
Karin Huber

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 25 Jul 2011, 06:45 AM
Hello Karin,

 We had a similar issue in the method that you have specified. It was resolved and it will be included in the next latest internal build that is expected this Monday.

May you please check it when available and share with us if the problem still persists?

Best wishes,
Didie
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
GridView
Asked by
Karin
Top achievements
Rank 2
Answers by
Dimitrina
Telerik team
Share this question
or