"Element is already the child of another element" error with DataPager

2 posts, 0 answers
  1. Scott
    Scott avatar
    13 posts
    Member since:
    Apr 2011

    Posted 25 Apr 2011 Link to this post

    Greetings.

    I'm using a Dataform (really need full annotations support in your RadDataForm!) with a RadGridView & RadDataPager in an Mvvm Light application. The DataForm/RadGridView/RadDataPager are all bound to a QueryableCollectionView sitting in my ViewModel, and my DataPager PageSize property is set to 10.

    If my collection has <10 items, I have no problem adding a new item to the collection. However, once I get to 10 items, then click the + sign in my dataform to add a new item, I get the following error:

    Error: Unhandled Error in Silverlight Application
    Code: 4009   
    Category: ManagedRuntimeError      
    Message: Element is already the child of another element.    

    I tried binding an EventToCommand on the BeginningEdit event, and adjusting the page size accordingly, but that command never triggers. I'm rather at a loss on how else to proceed.

    I have a sample project already created that demonstrates this, but I'm not able to attach the file. If you have any repository I can post/email into, I'm happy to do so.

    Thanks for your help!

    Scott
  2. Scott
    Scott avatar
    13 posts
    Member since:
    Apr 2011

    Posted 26 Apr 2011 Link to this post

    Solution to this turned out to be quite simple. I used EventToCommand to fire a command off on AddingNewItem (obviously not BeginningEdit, mispost). I then simply enter MyQueryableCollectionView.MoveToLastPage(). Boom. Done. Good game, thanks for playing.

    Simplest of solutions...
  3. DevCraft banner
Back to Top