I have a RadGridView that is bound to a DomainDataSource (Order) that has a column defined as follows:
TransportationMode is an entity of type TransportationMode and a property of Order --> (Order.TransportationMode)
TransportationMode can be NULL
If I try to sort on the TransportationMode column by clicking in the column header and either all the Orders have a null TransportationMode or the current row before clicking the header has a null TransportationMode then I receive the following error:
Exception:System.InvalidOperationException
Message:Failed to compare two elements in the array.
User Data:
Stack trace: at System.Collections.Generic.ArraySortHelper`1.BinarySearch(T[] array, Int32 index, Int32 length, T value, IComparer`1 comparer)
at System.Array.BinarySearch[T](T[] array, Int32 index, Int32 length, T value, IComparer`1 comparer)
at System.Collections.Generic.List`1.BinarySearch(Int32 index, Int32 count, T item, IComparer`1 comparer)
at System.Collections.Generic.List`1.BinarySearch(T item, IComparer`1 comparer)
at Telerik.Windows.Data.KeyedCollection.IndexOf(Object value)
at Telerik.Windows.Data.QueryableCollectionView.InternalIndexOf(Object item)
at Telerik.Windows.Data.QueryableCollectionView.TryRestorePreviousCurrency()
at Telerik.Windows.Data.QueryableCollectionView.InitializeCurrencyOnRefresh()
at Telerik.Windows.Data.QueryableCollectionView.RefreshOverride()
at Telerik.Windows.Data.QueryableCollectionView.RefreshInternal()
at Telerik.Windows.Data.QueryableCollectionView.RefreshOrDefer()
at Telerik.Windows.Data.QueryableCollectionView.ProcessSynchronousCollectionChanged(NotifyCollectionChangedEventArgs args)
at Telerik.Windows.Data.QueryableCollectionView.ProcessCollectionChanged(NotifyCollectionChangedEventArgs args)
at Telerik.Windows.Data.QueryableCollectionView.OnSourceCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
at Telerik.Windows.Data.QueryableCollectionView.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.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 Telerik.Windows.Controls.DomainServices.DomainServiceCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
at Telerik.Windows.Data.RadObservableCollection`1.ResumeNotifications()
at Telerik.Windows.Controls.DomainServices.DomainServiceCollection`1.OnLoadOperationCompleted(LoadOperation`1 loadOperation)
at System.ServiceModel.DomainServices.Client.DomainContext.<>c__DisplayClass13`1.<Load>b__11(LoadOperation lo)
at System.ServiceModel.DomainServices.Client.LoadOperation.<>c__DisplayClass4`1.<Create>b__0(LoadOperation`1 arg)
at System.ServiceModel.DomainServices.Client.LoadOperation`1.InvokeCompleteAction()
at System.ServiceModel.DomainServices.Client.OperationBase.Complete(Object result)
at System.ServiceModel.DomainServices.Client.LoadOperation.Complete(DomainClientResult result)
at System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult)
at System.ServiceModel.DomainServices.Client.DomainContext.<>c__DisplayClass1b.<Load>b__17(Object )
Inner Exception:System.NullReferenceException
Message:Object reference not set to an instance of an object.
User Data:
Stack trace: at lambda_method(Closure , Orders )
at Telerik.Windows.Data.FuncExtensions.<>c__DisplayClass1`2.<ToUntypedFunc>b__0(Object item)
at Telerik.Windows.Data.FunctionComparer.Compare(Object x, Object y)
at System.Collections.Generic.ArraySortHelper`1.InternalBinarySearch(T[] array, Int32 index, Int32 length, T value, IComparer`1 comparer)
at System.Collections.Generic.ArraySortHelper`1.BinarySearch(T[] array, Int32 index, Int32 length, T value, IComparer`1 comparer)
Can you please help?
<radGrid:GridViewDataColumn UniqueName="TransportationMode" DataMemberBinding="{Binding Path=TransportationMode.DescModeTransp, Mode=TwoWay}" IsReadOnly="True" IsGroupable="True" Width="Auto" IsVisible="True">
<radGrid:GridViewDataColumn.Header>
<TextBlock Text="Mode" ToolTipService.ToolTip="Mode" />
</radGrid:GridViewDataColumn.Header>
</radGrid:GridViewDataColumn>
TransportationMode is an entity of type TransportationMode and a property of Order --> (Order.TransportationMode)
TransportationMode can be NULL
If I try to sort on the TransportationMode column by clicking in the column header and either all the Orders have a null TransportationMode or the current row before clicking the header has a null TransportationMode then I receive the following error:
Exception:System.InvalidOperationException
Message:Failed to compare two elements in the array.
User Data:
Stack trace: at System.Collections.Generic.ArraySortHelper`1.BinarySearch(T[] array, Int32 index, Int32 length, T value, IComparer`1 comparer)
at System.Array.BinarySearch[T](T[] array, Int32 index, Int32 length, T value, IComparer`1 comparer)
at System.Collections.Generic.List`1.BinarySearch(Int32 index, Int32 count, T item, IComparer`1 comparer)
at System.Collections.Generic.List`1.BinarySearch(T item, IComparer`1 comparer)
at Telerik.Windows.Data.KeyedCollection.IndexOf(Object value)
at Telerik.Windows.Data.QueryableCollectionView.InternalIndexOf(Object item)
at Telerik.Windows.Data.QueryableCollectionView.TryRestorePreviousCurrency()
at Telerik.Windows.Data.QueryableCollectionView.InitializeCurrencyOnRefresh()
at Telerik.Windows.Data.QueryableCollectionView.RefreshOverride()
at Telerik.Windows.Data.QueryableCollectionView.RefreshInternal()
at Telerik.Windows.Data.QueryableCollectionView.RefreshOrDefer()
at Telerik.Windows.Data.QueryableCollectionView.ProcessSynchronousCollectionChanged(NotifyCollectionChangedEventArgs args)
at Telerik.Windows.Data.QueryableCollectionView.ProcessCollectionChanged(NotifyCollectionChangedEventArgs args)
at Telerik.Windows.Data.QueryableCollectionView.OnSourceCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
at Telerik.Windows.Data.QueryableCollectionView.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.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 Telerik.Windows.Controls.DomainServices.DomainServiceCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
at Telerik.Windows.Data.RadObservableCollection`1.ResumeNotifications()
at Telerik.Windows.Controls.DomainServices.DomainServiceCollection`1.OnLoadOperationCompleted(LoadOperation`1 loadOperation)
at System.ServiceModel.DomainServices.Client.DomainContext.<>c__DisplayClass13`1.<Load>b__11(LoadOperation lo)
at System.ServiceModel.DomainServices.Client.LoadOperation.<>c__DisplayClass4`1.<Create>b__0(LoadOperation`1 arg)
at System.ServiceModel.DomainServices.Client.LoadOperation`1.InvokeCompleteAction()
at System.ServiceModel.DomainServices.Client.OperationBase.Complete(Object result)
at System.ServiceModel.DomainServices.Client.LoadOperation.Complete(DomainClientResult result)
at System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult)
at System.ServiceModel.DomainServices.Client.DomainContext.<>c__DisplayClass1b.<Load>b__17(Object )
Inner Exception:System.NullReferenceException
Message:Object reference not set to an instance of an object.
User Data:
Stack trace: at lambda_method(Closure , Orders )
at Telerik.Windows.Data.FuncExtensions.<>c__DisplayClass1`2.<ToUntypedFunc>b__0(Object item)
at Telerik.Windows.Data.FunctionComparer.Compare(Object x, Object y)
at System.Collections.Generic.ArraySortHelper`1.InternalBinarySearch(T[] array, Int32 index, Int32 length, T value, IComparer`1 comparer)
at System.Collections.Generic.ArraySortHelper`1.BinarySearch(T[] array, Int32 index, Int32 length, T value, IComparer`1 comparer)
Can you please help?