RadPaneGroupRegionAdapter not working for Prism 4 November release

10 posts, 0 answers
  1. Wang
    Wang avatar
    3 posts
    Member since:
    Nov 2010

    Posted 18 Nov 2010 Link to this post

    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!

  2. Rayne
    Rayne avatar
    241 posts
    Member since:
    Sep 2010

    Posted 22 Nov 2010 Link to this post

    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?
  3. UI for WPF is Visual Studio 2017 Ready
  4. Rayne
    Rayne avatar
    241 posts
    Member since:
    Sep 2010

    Posted 22 Nov 2010 Link to this post

    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.
  5. Wang
    Wang avatar
    3 posts
    Member since:
    Nov 2010

    Posted 22 Nov 2010 Link to this post

    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
  6. Wang
    Wang avatar
    3 posts
    Member since:
    Nov 2010

    Posted 22 Nov 2010 Link to this post

    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.
  7. Rayne
    Rayne avatar
    241 posts
    Member since:
    Sep 2010

    Posted 23 Nov 2010 Link to this post

    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.
  8. Djoni Cla Ruffin
    Djoni Cla Ruffin avatar
    7 posts
    Member since:
    Jul 2010

    Posted 06 Dec 2010 Link to this post

    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
  9. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 09 Dec 2010 Link to this post

    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
  10. Ed James
    Ed James avatar
    9 posts
    Member since:
    Sep 2008

    Posted 29 Oct 2013 Link to this post

    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);
  11. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 31 Oct 2013 Link to this post

    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 >>
Back to Top
UI for WPF is Visual Studio 2017 Ready