Drag Drop Issue With MVVM

2 posts, 0 answers
  1. Brett
    Brett avatar
    15 posts
    Member since:
    Sep 2010

    Posted 14 Apr 2013 Link to this post

    I two list boxes on a page that are bound to properties on a view model.  Both list, using for binding, are IEnumerable<T>.  When I drag an item from the first list box, everything works fine.  When I drop that item into the second list box, I get the following error:

    Unhandled Error in Silverlight Application
    Code: 4004   
    Category: ManagedRuntimeError      
    Message: System.NotSupportedException: Collection is read-only.
       at System.ThrowHelper.ThrowNotSupportedException(ExceptionResource resource)
       at System.Collections.ObjectModel.ReadOnlyCollection`1.System.Collections.IList.Remove(Object value)
       at Telerik.Windows.DragDrop.Behaviors.DragDropBehavior`1.RemoveItems(IList source, IEnumerable items)
       at Telerik.Windows.DragDrop.Behaviors.DragDropBehavior`1.DragDropCompleted(TState state)
       at Telerik.Windows.DragDrop.Behaviors.DragDropHelper`2.DragDropCompleted(FrameworkElement dropItemsControl, Object data, Type itemType, Boolean wasCanceled)
       at Telerik.Windows.Controls.RadListBoxDragDropHelper.DragDropCompleted(FrameworkElement dropItemsControl, Object data, Type itemType, Boolean wasCanceled)
       at Telerik.Windows.DragDrop.Behaviors.DragDropHelper`2.CompleteDrag(Object data, DragDropEffects effects)
       at Telerik.Windows.DragDrop.Behaviors.DragDropHelper`2.DragDropCompleted(Object sender, DragDropCompletedEventArgs e)
       at Telerik.Windows.DragDrop.DragDropCompletedEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
       at Telerik.Windows.RadRoutedEventArgs.InvokeHandler(Delegate handler, Object target)
       at Telerik.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RadRoutedEventArgs routedEventArgs)
       at Telerik.Windows.RouteItem.InvokeHandler(RadRoutedEventArgs routedEventArgs)
       at Telerik.Windows.EventRoute.InvokeHandlersImpl(Object source, RadRoutedEventArgs args, Boolean raisedAgain)
       at Telerik.Windows.EventRoute.InvokeHandlers(Object source, RadRoutedEventArgs args)
       at Telerik.Windows.RadRoutedEventHelper.RaiseEvent(DependencyObject element, RadRoutedEventArgs args)
       at Telerik.Windows.DependencyObjectExtensions.RaiseEvent(DependencyObject element, RadRoutedEventArgs e)
       at Telerik.Windows.DragDrop.DragOperation.RaiseDragDropCompleted(DragDropEffects effects, Object dataObject)
       at Telerik.Windows.DragDrop.DragOperation.OnDrop(DependencyObject source)
       at Telerik.Windows.DragDrop.DragOperation.DragSourceLostMouseCapture(Object sender, MouseEventArgs e)
       at Telerik.Windows.DragDrop.DragHelper.OnLostMouseCapture(Object sender, MouseEventArgs e)
       at MS.Internal.CoreInvokeHandler.InvokeEventHandler(UInt32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
       at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName, UInt32 flags)

    The items source on both list boxes are bound to IEnumerable<T> that is populated from a Ria Services Load Operation. Could some one please help me figure out this issue?

    Thanks,
    Brett

     

     

  2. Brett
    Brett avatar
    15 posts
    Member since:
    Sep 2010

    Posted 15 Apr 2013 Link to this post

    I was able to correct this issue by switching my ItemSource type from IEnumerable<T> to ObservableCollection<T>.
  3. DevCraft banner
Back to Top