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

Exception thrown when DataBound item changed

2 Answers 83 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Iron
Iron
Andrew asked on 02 Feb 2012, 04:53 AM
I have a RadPropertyWindow where the selected item is determined by DataBinding:

        <telerik:RadPropertyGrid x:Name="_radPropertyGrid" Grid.Row="2" Item="{Binding SelectedElement}" />

When the SelectedElement is changed from NULL to an element, it works as expected.

Then, when this element changes again, an exception gets thrown.


System.ArgumentOutOfRangeException was unhandled
  Message=Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
  Source=mscorlib
  ParamName=index
  StackTrace:
       at System.ThrowHelper.ThrowArgumentOutOfRangeException()
       at System.Collections.Generic.List`1.get_Item(Int32 index)
       at System.Collections.ObjectModel.Collection`1.get_Item(Int32 index)
       at Telerik.Windows.Controls.Data.PropertyGrid.PropertyDefinitionCollection.RemoveItem(Int32 index) in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Controls\Data\PropertyGrid\PropertyDefinitionCollection.cs:line 55
       at System.Collections.ObjectModel.Collection`1.RemoveAt(Int32 index)
       at Telerik.Windows.Controls.RadPropertyGrid.ClearAutoGeneratedPropertyDefinitions() in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Controls\Data\PropertyGrid\RadPropertyGrid.cs:line 325
       at Telerik.Windows.Controls.RadPropertyGrid.GeneratePropertyDefinitions() in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Controls\Data\PropertyGrid\RadPropertyGrid.cs:line 291
       at Telerik.Windows.Controls.RadPropertyGrid.OnItemPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args) in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Controls\Data\PropertyGrid\RadPropertyGrid.cs:line 251
       at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
       at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
       at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
       at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
       at System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp)
       at System.Windows.Data.BindingExpressionBase.Invalidate(Boolean isASubPropertyChange)
       at System.Windows.Data.BindingExpression.TransferValue(Object newValue, Boolean isASubPropertyChange)
       at System.Windows.Data.BindingExpression.ScheduleTransfer(Boolean isASubPropertyChange)
       at MS.Internal.Data.ClrBindingWorker.NewValueAvailable(Boolean dependencySourcesChanged, Boolean initialValue, Boolean isASubPropertyChange)
       at MS.Internal.Data.PropertyPathWorker.UpdateSourceValueState(Int32 k, ICollectionView collectionView, Object newValue, Boolean isASubPropertyChange)
       at MS.Internal.Data.ClrBindingWorker.OnSourcePropertyChanged(Object o, String propName)
       at MS.Internal.Data.PropertyPathWorker.System.Windows.IWeakEventListener.ReceiveWeakEvent(Type managerType, Object sender, EventArgs e)
       at System.Windows.WeakEventManager.DeliverEventToList(Object sender, EventArgs args, ListenerList list)
       at System.ComponentModel.PropertyChangedEventManager.OnPropertyChanged(Object sender, PropertyChangedEventArgs args)
       at NavigationPathEditor.ThreadSafeNotifyPropertyChanged.<>c__DisplayClass3.<NotifyPropertyChanged>b__1() in C:\Development\PlayArea\NavigationPathEditor\NavigationPathEditor\ThreadSafeNotifyPropertyChanged.cs:line 39
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.DispatcherOperation.InvokeImpl()
       at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
       at System.Threading.ExecutionContext.runTryCode(Object userData)
       at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Windows.Threading.DispatcherOperation.Invoke()
       at System.Windows.Threading.Dispatcher.ProcessQueue()
       at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
       at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
       at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
       at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
       at System.Windows.Application.RunDispatcher(Object ignore)
       at System.Windows.Application.RunInternal(Window window)
       at System.Windows.Application.Run(Window window)
       at System.Windows.Application.Run()
       at NavigationPathEditor.App.Main() in C:\Development\PlayArea\NavigationPathEditor\NavigationPathEditor\obj\x86\Debug\App.g.cs:line 0
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

2 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 02 Feb 2012, 07:53 AM
Hello,

Recently we have resolved a similar issue. Can you please confirm what is the exact version that you use? Do you reproduce the problem with the latest internal build?

All the best,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Andrew
Top achievements
Rank 1
Iron
Iron
answered on 02 Feb 2012, 11:09 PM
I am using WPF Q3 2011.

The assembly is: Telerik.Windows.Controls.Data.dll, v4.0.30319

I think this was "v.2011.3.1116.40 Dev"

I upgraded to "v.2011.3.1220.40 Dev". (RadControls_for_WPF_2011_3_1220_Dev_hotfix)

It seems to work now.






 

Tags
PropertyGrid
Asked by
Andrew
Top achievements
Rank 1
Iron
Iron
Answers by
Dimitrina
Telerik team
Andrew
Top achievements
Rank 1
Iron
Iron
Share this question
or