所以我遇到了Telerik的UWP RadDataGrid问题。我有一个命令,用于更新绑定到RadDataGrid的集合中的项目。它设置了3个属性,我遇到的一个问题是一个枚举属性。状态。 Status枚举用于几个DataTemplateSelector和StyleSelector中。没有为Status属性定义的列。更新后,将引发异常:
System.InvalidOperationException
HResult=0x80131509
Message=Failed to compare two elements in the array.
Source=System.Private.CoreLib
StackTrace:
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 Telerik.Data.Core.Group.IndexOf(Object item, IComparer`1 sortComparer)
at Telerik.Data.Core.Engine.ParallelDataEngine.Telerik.Data.Core.Engine.IDataEngine.GetFilteredItemIndex(Object item)
at Telerik.Data.Core.LocalDataSourceProvider.ProcessPropertyChanged(Object sender, PropertyChangedEventArgs e)
at Telerik.Data.Core.LocalDataSourceProvider.DataView_ItemPropertyChanged(Object sender, PropertyChangedEventArgs e)
at Telerik.Data.Core.EnumerableDataSourceView.HandlePropertyChanged(Object sender, PropertyChangedEventArgs e)
at Telerik.Data.Core.EnumerableDataSourceView.Telerik.Core.IWeakEventListener.ReceiveEvent(Object sender, Object args)
at Telerik.Core.WeakEventHandlerList`1.OnPropertyChanged(Object sender, PropertyChangedEventArgs e)
at System.ComponentModel.PropertyChangedEventHandler.Invoke(Object sender, PropertyChangedEventArgs e)
at GalaSoft.MvvmLight.ObservableObject.RaisePropertyChanged(String propertyName)
at GalaSoft.MvvmLight.ViewModelBase.RaisePropertyChanged[T](String propertyName, T oldValue, T newValue, Boolean broadcast)
at GalaSoft.MvvmLight.ViewModelBase.Set[T](T& field, T newValue, Boolean broadcast, String propertyName)
at MyLineItemViewModel.set_Status(Status value) in MyLineItemViewModel.cs:line 121
Inner Exception 1:
ArgumentException: Object must be of type String.
我经历了将enum属性的数据类型更改为字符串的问题,但是仍然遇到相同的问题。对于它的价值,我正在通过PropertySortDescriptors对集合进行排序,通过DelegateFilterDescriptor进行过滤,并通过PropertyGroupDescriptor进行分组。有人有建议吗?