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

On using ItemsSource

4 Answers 122 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Andrea
Top achievements
Rank 1
Andrea asked on 17 Dec 2013, 07:24 AM
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!

4 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 17 Dec 2013, 07:59 AM
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 >>
0
Andrea
Top achievements
Rank 1
answered on 17 Dec 2013, 08:23 AM
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!

0
Yana
Telerik team
answered on 19 Dec 2013, 01:57 PM
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 >>
0
Tobias
Top achievements
Rank 1
answered on 04 Jul 2016, 11:36 AM

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.

 

Tags
Docking
Asked by
Andrea
Top achievements
Rank 1
Answers by
Yana
Telerik team
Andrea
Top achievements
Rank 1
Tobias
Top achievements
Rank 1
Share this question
or