On using ItemsSource

5 posts, 0 answers
  1. Andrea
    Andrea avatar
    2 posts
    Member since:
    Nov 2013

    Posted 17 Dec 2013 Link to this post

    I've created a class inheriting from RadPane, and I'm binding a list of istances of this class to the ItemsSource property of the RadDocking. If I add elements to the list and then update (fire the PropertyChanged event for the property) it works great, but it crashes when I try to delete an element from the collection and then refresh the property.

    If I create a custom factory for the control and I override the RemovePane method, I get null pointers when the method is called.

    Has somebody any idea of what I am doing wrong? I can provide a sample if needed.

    Thanks!
  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 17 Dec 2013 Link to this post

    Hello Andrea,

    Have you checked our SDK example which demonstrates how to achieve this functionality ( here is the link: https://github.com/telerik/xaml-sdk/tree/master/Docking/PaneGroupItemsSource)? Can you reproduce the described issue with it?  Any additional information you could send us on your approach will be helpful.

    Looking forward to your reply.

    Regards,
    Yana
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Andrea
    Andrea avatar
    2 posts
    Member since:
    Nov 2013

    Posted 17 Dec 2013 Link to this post

    Dear Yana,

        the example you pointed out is slightly different than what's shown in the documentation, which instructs to bind panels directly to the RadDocking:

    <telerik:RadDocking PanesSource="{Binding Panes}"> 
        <telerik:RadDocking.DockingPanesFactory>
             <telerik:DockingPanesFactory/>
         </telerik:RadDocking.DockingPanesFactory>
    </
    telerik:RadDocking>

     

    At http://www.telerik.com/help/wpf/raddocking-features-panes-panesource.html

    Would it be possible to use this approach, or is it compulsory to do it the way the example shows?

    Thanks!

  5. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 19 Dec 2013 Link to this post

    Hi Andrea,

    Indeed, you should use the approach explained in the article. I am sorry for my confusion.

    As to the question - I'm pasting the reply from the support ticket on the same matter:

    You are receiving this error as in the RemovePane method  inside DockingPanesFactory the pane is actually already removed (as the Panes list is syncronized with the CustomRadPaneViewModels list). What we can suggest is to add/remove items from the Panes collection directly and update the ViewModels collection accordingly.  Also note that currently the getter of the Panes collection will generate a new list each time it is called.

    Regards,
    Yana
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  6. Tobias
    Tobias avatar
    1 posts
    Member since:
    Jul 2016

    Posted 04 Jul in reply to Andrea Link to this post

    I had the same Problem you described. I bound RadDocking PanesSource Property to an ObservableCollection and everything workd fine until I removed one Element from the backing collection: DockingPanesFactory.RemovePane() was called with the RadPane parmater set to null which in turn emitted an InvalidArgumentException in the default implementation.

    It turned out that I had forgotten to set the RadPane.DataContext Property in DockingPanesfactory.CreatePaneForItem. That caused DockingPanesFactory.GetPaneForItem() always to return null which was then fed into the DockingPanesFactory.RemovePane() call.

     

Back to Top
UI for WPF is Visual Studio 2017 Ready