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

RadPaneGroupRegionAdapter not working for Prism 4 November release

9 Answers 246 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Yu
Top achievements
Rank 1
Yu asked on 19 Nov 2010, 04:17 AM
Hi,

I downloaded the source project with the RadPaneGroupRegionAdapter from here:

Using the RadDocking control with Prism 

And I updated the reference and the bootstrapper to use the Prism 4 November release. Then I found it's no longer working. 

There is no exceptions, just that the RadPane's are not showing.

Following are the only code change I made, (all inside bootstrapper):

using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
 
using Telerik.Windows.Controls;
using Microsoft.Practices.Prism.UnityExtensions;
using Microsoft.Practices.Prism.Regions;
using Microsoft.Practices.Prism.Modularity;
using Microsoft.Practices.Unity;
 
 
namespace RadDockingAndPRISM
{
    public class Bootstrapper : UnityBootstrapper
    {
        protected override RegionAdapterMappings ConfigureRegionAdapterMappings()
        {
            var mappings = base.ConfigureRegionAdapterMappings();
 
            mappings.RegisterMapping(typeof(RadPaneGroup), ((IUnityContainer)Container).Resolve<RadPaneGroupRegionAdapter>());
 
            return mappings;
        }
 
        protected override DependencyObject CreateShell()
        {
            Shell shell = Container.Resolve<Shell>();
#if SILVERLIGHT
            App.Current.RootVisual = shell;
#else
            shell.Show();
#endif
 
            return shell;
        }
 
        //protected override IModuleCatalog GetModuleCatalog()
        //{
        //    var catalog = new ModuleCatalog();
        //    catalog.AddModule(typeof(ModuleA.ModuleA));
        //    catalog.AddModule(typeof(ModuleB.ModuleB));
        //    return catalog;
        //}
 
        protected override void ConfigureModuleCatalog()
        {
            base.ConfigureModuleCatalog();
            ((ModuleCatalog)ModuleCatalog).AddModule(typeof(ModuleA.ModuleA));
            ((ModuleCatalog)ModuleCatalog).AddModule(typeof(ModuleB.ModuleB));
 
 
        }
    }
}

Could you please help? Thanks!

9 Answers, 1 is accepted

Sort by
0
Rayne
Top achievements
Rank 1
answered on 22 Nov 2010, 04:20 PM
I'm having the same problem. Radpane is not showing up in region (radpanegroup), even though all code seems to be working properly (pane is added to region if I step through code).

Need to get this working as quickly as possible (if possible) as it has stalled development of my application. Should I continue to build my modules deriving from RadPane until this gets sorted out?
0
Rayne
Top achievements
Rank 1
answered on 22 Nov 2010, 05:07 PM
After stepping through the RegionAdapter code (which was taken from the blog post), It steps through the Adapt method twice. Once with a collectionChanged action of Add (which makes sense), then again with the collectionChanged action of Reset which then removes the pane from the PaneGroup. If I comment out the code in the Reset block of the case statement, then my pane appears.
0
Yu
Top achievements
Rank 1
answered on 23 Nov 2010, 02:49 AM
Hi Rayne,

Thanks very much for the reply. Yes I confirm seeing the same behavior, for each RadPane added, the Adapt was called twice, with the second e.Action equals to "Reset". I don't have a clue why this is the case.

I'm also running a very tight schedule here. If I can't solve this within this week I'll have no choice but to revert back to the CTP version of the libraries. At least it works for the RadPaneGroup.

Wang Yu
0
Yu
Top achievements
Rank 1
answered on 23 Nov 2010, 03:44 AM
Please refer to this link:
http://www.telerik.com/community/forums/silverlight/docking/prism-4-and-telerik-raddocking.aspx

Basically, the reply was saying that why "Reset" is called after "Add" is Microsoft logic. And the fix to the previous RadPaneGroupRegionAdapter is to modify the adapter class so that the Reset case looks like this

case NotifyCollectionChangedAction.Reset:
                        regionTarget
                            .EnumeratePanes()
                            .ToList()
                            .ForEach(p => p.RemoveFromParent());
                        foreach (var view in region.Views)
                        {
                            regionTarget.Items.Add(view);
                        }
                        break;

To me, this doesn't make sense at all, pure waste of CPU. But anyway, as long as it works, no point spending more time on it.
0
Rayne
Top achievements
Rank 1
answered on 23 Nov 2010, 12:39 PM
Wang, Thanks so much for the reply.

I will definitely modify my code to make it work even though it really doesn't make any sense.
0
Djoni Cla Ruffin
Top achievements
Rank 1
answered on 07 Dec 2010, 12:47 AM
Hi,
Your solution works fine. But I have another problem. When  User close manually RadPane, this RadPane is not delete from Region's Views. How Can I solve this Problem?
Thanks for all.
Ruffin
0
Miroslav Nedyalkov
Telerik team
answered on 09 Dec 2010, 01:24 PM
Hi Djoni,

 As you can see from the example the synchronization is one-way. If you need to change the region when a pane is closed you need to do it by hand - it is not implemented in the demo.

Regards,
Miroslav Nedyalkov
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
0
Ed James
Top achievements
Rank 2
answered on 29 Oct 2013, 08:48 AM
Hi Miroslav,

How can a pane be closed by hand? I'm using RadPaneGroupRegionAdaptor, MVVC, Prism.

I have the issue where a user closes a pane, and it's therefore not re-shown with the code below:

var region = this.regionManager.Regions[RegionNames.DocumentHostRegion];
var view = this.serviceLocator.GetInstance<MyView>();
 
if (region.Views.Contains(view))
{
     region.Remove(view);
}
region.Add(view);
region.Activate(view);
0
Vladi
Telerik team
answered on 31 Oct 2013, 09:44 AM
Hi,

As we see that you have posted about the same issue in another forum thread could we continue the discussion there.

Regards,
Vladi
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 >>
Tags
Docking
Asked by
Yu
Top achievements
Rank 1
Answers by
Rayne
Top achievements
Rank 1
Yu
Top achievements
Rank 1
Djoni Cla Ruffin
Top achievements
Rank 1
Miroslav Nedyalkov
Telerik team
Ed James
Top achievements
Rank 2
Vladi
Telerik team
Share this question
or