DocumentHost & Prism Region

52 posts, 0 answers
  1. Ian
    Ian avatar
    3 posts
    Member since:
    May 2009

    Posted 21 Jun 2009 Link to this post

    Hi,

    I'm trying to create a similar layout to visual studio using RadDocking and prism regions.  The xaml is as follows:

     
    <tcd:RadDocking Grid.Row="2" Grid.ColumnSpan="3">
                <tcd:RadDocking.DocumentHost>
                    <tcn:RadTabControl
                            regions:RegionManager.RegionName="MainRegion"
                            infRegions:RadTabControlRegionAdapter.ItemContainerStyle="{StaticResource MainRegionTabControlItemStyle}"
                             AllowDragReorder="True"/>
                </tcd:RadDocking.DocumentHost>

                <tcd:RadSplitContainer InitialPosition="DockedLeft">
                    <tcd:RadPaneGroup>
                        <tcd:RadPane Header="Task">
                            <tcd:RadPane.Content>
                                <ContentControl regions:RegionManager.RegionName="LeftRegion" />
                            </tcd:RadPane.Content>
                        </tcd:RadPane>
                    </tcd:RadPaneGroup>
                </tcd:RadSplitContainer>
                <tcd:RadSplitContainer InitialPosition="DockedRight">
                    <tcd:RadPaneGroup>
                        <tcd:RadPane Header="Task">
                            <tcd:RadPane.Content>
                                <ContentControl regions:RegionManager.RegionName="RightRegion" />
                            </tcd:RadPane.Content>
                        </tcd:RadPane>
                    </tcd:RadPaneGroup>
                </tcd:RadSplitContainer>
                <tcd:RadSplitContainer InitialPosition="DockedBottom">
                    <tcd:RadPaneGroup>
                        <tcd:RadPane Header="Task">
                            <tcd:RadPane.Content>
                                <ContentControl regions:RegionManager.RegionName="BottomRegion" />
                            </tcd:RadPane.Content>
                        </tcd:RadPane>
                    </tcd:RadPaneGroup>
                </tcd:RadSplitContainer>
            </tcd:RadDocking>

    The left, right and bottom regions work as expected i.e. I can add and remove views as required.  The problem is with the main region.  Unfortunately, prism does not add the MainRegion to the RegionManager and I thus can't load any content.  I thought the problem might be something to do the Tabcontrol (even though I have used this in other applications) so I amended the code as follows:

     <tcd:RadDocking.DocumentHost>
        <ContentControl regions:RegionManager.RegionName="MainRegion"/>  
    </tcd:RadDocking.DocumentHost>

    Again we have the same problem; the region is not added to the RegionManager.  I have tried manually adding the region in the code behind by directly referencing the framework element and calling the RegionManager.SetRegionName() method.  Again no luck.  I think the problem relates to document host however I can't think why.  Any ideas?

    Thanks in advance

    Ian

  2. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 22 Jun 2009 Link to this post

    Hello Ian,

    Attached, you can find a small Prism application demonstrating the approach you want to achieve. The project build is including the latest RadControls for Silverlight binaries (version - 2009.1.605). Don't hesitate to contact us in case you need more explanation.

    All the best,
    Kaloyan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. DevCraft banner
  4. Ian
    Ian avatar
    3 posts
    Member since:
    May 2009

    Posted 22 Jun 2009 Link to this post

    Kaloyan,

    Thanks for the quick reply.  Your app demostrates how to use raddocking with prism view discovery however unfortunetly I need to implement view injection.  Your app resolves a view and loads it in to a region once the region is created.  It does this by using the following syntax:

    regionManager.RegisterViewWithRegion("MainRegion", typeof(MainRegion));

    Unfortunetly I need to use the following syntax as I need to add and remove views on demand:

    IRegion mainRegion = _regionManager.Regions[RegionNames.MainRegion];
    mainRegion.Add(view, "MainRegionView");

    In anycase, your app has confirmed something that I couldn't previously explain.  I thought the MainRegion never got created however I now think the MainRegion (in RadDocking.DocumentHost) gets created and is then deactivated shortly after.  I'm not exactly sure why this is however the region is definietly not in the RegionManager.Regions collection (i.e. is not a SingleActiveRegion?).

    In investigating this issue I have, frustratingly, found another problem.  The left and right regions in your app will deactivate if unpinned.  This is not much of a problem in my app as I will load content only once into the docked left and right regions (i.e. I can use view discovery).  I don't really care if the regions are subsequently de-activated.  The problem is with the main region as I need to continually add and remove content (views).  So the question is what causes the main region to deactivate?  And how can I prevent it?

    I can prevent the left and right regions from deactivating by setting the IsPinned property to true.  I wonder if there is a property I can set that will keep the main region activate?

    Thanks in advance

    Ian





  5. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 23 Jun 2009 Link to this post

    Hello Ian,

    This time we were able to reproduce the issue but after spearing a lot of time of debugging, our team couldn't find the real bug that causes the problem you described. I am attaching a new modified version of the Prism and RadDock project which contains a simple workaround of this issue.

    Hope this helps.

    Sincerely yours,
    Kaloyan
    the Telerik team

    Instantly find answers to your questions on the newTelerik Support Portal.
    Check out the tipsfor optimizing your support resource searches.
  6. Julian
    Julian avatar
    7 posts
    Member since:
    Jul 2008

    Posted 25 Jun 2009 Link to this post

    Hi

    We had a similar issue, so I hope the following helps.

    For the RadDock Tab controls (your MainRegion - inside DocumentHost), the View Discovery method of loading a View into the TabRegion works fine, but the View Injection method fails - it says it can't find the TabRegion in the RegionManager.  
                       

    This fails with an exception - use of View Injection in TabRegion 
                        _regionManager.Regions[RegionNames.TabRegion].Add(new HtmlHostView());

    This works - use of View Discovery in TabRegion.  Note how the new view is created using a lambda expression, rather than the new() constructor.
                        _regionManager.RegisterViewWithRegion(RegionNames.TabRegion, () => new HtmlHostView());

    This works - while it uses View Injection the the view is NOT being added to the TabRegion.
                        _regionManager.Regions[RegionNames.DockedLeftRegion].Add(new HtmlHostView());

    See http://compositewpf.codeplex.com/Thread/View.aspx?ThreadId=53610 (which suggests the solution) and http://blogs.southworks.net/jdominguez/2008/04/using-the-presentation-model-in-wpf/ for details.

    Good luck

    Julian

    PS.  We're doing similar work with RadDocking and Prism, but found that if we defined Prism regions on RadPaneGroups we could load new RadPanes into these regions, but then got an exception whenever we Unpinned, Closed, or undocked (to floating) a RadPane.  You may be ok because you're not defining regions on RadPaneGroups.
    Xaml:
    <radDock:RadSplitContainer radDock:DockingPanel.InitialSize="400,400" Name="LeftContainer" InitialPosition="DockedLeft">

     

     

    <radDock:RadPaneGroup Regions:RegionManager.RegionName="DockedLeftRegion">

     

     

    <radDock:RadPane Header="Is Inside Prism Region, so will error when unpinned, closed or undocked">

     

     

    <TextBlock TextWrapping="Wrap">Test</TextBlock>

     

     

    </radDock:RadPane>

     

     

    </radDock:RadPaneGroup>

     

     

    </radDock:RadSplitContainer>

     

     

    Exception:
    {System.InvalidOperationException: Operation not supported on read-only collection.
       at System.Windows.Controls.ItemCollection.RemoveInternal(Object value)
       at System.Windows.PresentationFrameworkCollection`1.Remove(T value)
       at Telerik.Windows.Controls.RadPaneGroup.UnpinPane(RadPane pane)
       at Telerik.Windows.Controls.Docking.AutoHideArea.UnpinPane(RadPane pane)
       at Telerik.Windows.Controls.RadDocking.UnpinPane(RadPane radPane, AutoHideArea area, Boolean stopEvents)
       at Telerik.Windows.Controls.RadDocking.RadPane_PinChange(Object sender, PinChangeEventArgs args)

  7. Koen
    Koen avatar
    6 posts
    Member since:
    Jun 2009

    Posted 08 Jul 2009 Link to this post

    I'm testing the silverlight controls to see if they match my requirements. I do want to create a VS like experience (also with prism), however, the demo app which is attached to the answer will display only 1 view in a tabpane. I would like to define regions (dockable left / right / bottom and a main region) and then be able to display several view in the region, which has as an effect that multiple tabpanes are displayed, just like VS, where there will be tabs then.

    Is this possible with the docking control?
  8. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 13 Jul 2009 Link to this post

    Hello Koen,

    As a solution I am suggesting that you attach the Region property to a RadTabControl and when you add a new view you can add it to the RadTabControl as a RadTabItem. Please find attached a small project demonstrating this approach. Don't hesitate to write us if this does not prompt to your needs.

    Best wishes,
    Kaloyan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  9. Koen
    Koen avatar
    6 posts
    Member since:
    Jun 2009

    Posted 17 Jul 2009 Link to this post

    Hello Kaloyan,

    thanks for the reply, but that is unfortunately not exactly what I meant. I'll try to clarify more what I mean.

    I would like to be able to register a new view with the LeftRegion  in the example for instance which would result in this view being rendered as a new RadPane. So I would like to be able to say someting like:
    regionManager.RegisterViewWithRegion("LeftRegion", () => new LeftView());

    I would like that a new RadPane is added to the LeftRegion which has the LeftView as content.

    Is this possible with the RadDocking, or should I try to create a RegionAdapter for this? Has anybody maybe already tried to do this?

  10. Julian
    Julian avatar
    7 posts
    Member since:
    Jul 2008

    Posted 19 Jul 2009 Link to this post

    Hi Koen

     

    We've tried to do exactly what you're trying - see my previous post on 25 June.

     

    The trick is to define the regions on RadPaneGroups inside a RadSplitContainer.  For example:

    <radDock:RadSplitContainer radDock:DockingPanel.InitialSize="400,400" Name="LeftContainer" InitialPosition="DockedLeft">
    <radDock:RadPaneGroup Regions:RegionManager.RegionName="DockedLeftRegion">

    You can then add a new RadPane to the region :

    regionManager.RegisterViewWithRegion("DockedLeftRegion", () => new LeftView());

    Note that LeftView should inherit from RadPane because the Prism region is defined on a RadPaneGroup which expects RadPane children.

    The problem (as detailed in my previous post) is that you get an exception whenever you Unpin, Close, or undock (to floating) the new RadPane (LeftView in the example above), as the default Prism RegionAdapters don't handle removing a registered view from the visual tree.

    To fix this and continue to use Prism regions with RadDocking, you'll need to create a new RegionAdapter for RadPaneGroups. 

    We didn't have time to do this on our project, so we simply removed any use of Prism regions from the main page and created a simple utility class (called DockManager and registered with the Unity container so that Prism modules can access it) that allowed us to add new views (deriving from RadPane) to named RadPaneGroups.

    Julian

  11. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 20 Jul 2009 Link to this post

    Hello Julian,

    As Julin said, the prefer approach is to set the RegionName attached property to the RadPaneGroup.The view you want to add to the Region must derive form RadPane or set the new View as a content of the RadPane.Check the code bellow:
     regionManager.RegisterViewWithRegion("LeftRegion",  
                    () =>  
                    { 
                        var pane = new RadPane() { Title = "New RadPane" }; 
                        pane.Content = new LeftRegion(); 
                        return pane; 
                    }); 
    We are currently researching the origin of this strange behavior(when setting the Regions:RegionManager.RegionName attached property and then add there a new RadPane an exception is raised when floating or pin/unpin the new RadPane).

    Kind regards,
    Kaloyan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  12. Paul
    Paul avatar
    37 posts
    Member since:
    May 2009

    Posted 19 Aug 2009 Link to this post

    Kaloyan,

    Any progress on this?  I'm beginning a multi-year project that will leverage Prism on the docking control.  Getting the shell and supporting services right in the first phase is of upmost importance to the success of later phases.  Some of the features planned:
    • user will be able to save one or more main screen layouts
    • based upon the user's settings, load one of multiple shell layouts.  User will need to switch between these layouts at run-time.  These different layouts are essentially a saved layout loading into different regions.
    • modules may be pinned or unpinned
    • a user may only have access to a portion of the available modules
    • will be loading localization for the user
    • a main area document document area based upon work from other regions, so we will be dynamically creating tabs to show detailed data forms.

    From this thread it appears I should be looking at building a custom RegionAdapter for the docking control?

    Thanks,
    Paul from Minneapolis

  13. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 20 Aug 2009 Link to this post

    Hi Paul,

    The problem here is that when you pin/unpin/close a RadPane, the RadDocking automatically changes the RadPaneGroup where it is stored. Which is probably interfering with the Prism API (perhaps it is not allowed to change the region of the define view). As for now, creating an own RegionAdapter seems to be the only solution for the issue. Keep in mind, that RadDocking is not completely tested with the Prism infrastructure. Sorry once again for the inconvenienced caused.

    Best wishes,
    Kaloyan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  14. Paul
    Paul avatar
    37 posts
    Member since:
    May 2009

    Posted 20 Aug 2009 Link to this post

    Kaloyan,

    Thanks for the prompt reply.  Having to create a custom RegionAdapter is some extra work, yes, but I'd rather do that then have to build my own docking control.  The important thing here is I have a course of action.  I plan to implement first without custom RegionAdapter and walk into the Prism code to see if I can find the underlying cause.  I'll let you know my findings.

    Thanks,
    Paul from Minneapolis
  15. Mark Walker
    Mark Walker avatar
    2 posts
    Member since:
    Sep 2009

    Posted 19 Sep 2009 Link to this post

    Hi

    We have an app built in Silverlight with Prism, and I'm now considering using the RadDocking Control.
    Paul, did you complete a Region Adapter successfully? How long did it take? Any pointers/gotchas (don't suppose you can share your code)?

    Thanks

    Mark
  16. Paul
    Paul avatar
    37 posts
    Member since:
    May 2009

    Posted 19 Sep 2009 Link to this post

    Hi Mark,

    I wrote a couple of Region Adapters fairly quickly (a day or two) but wasn't able to fully test them as I'm still in design for the overall project.  Over the next three months, I'll be building a working prototype and I'll have to get them working soon as the docking control is key to our current UI framework.

    Regards,
    Paul from Minneapolis
  17. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 22 Sep 2009 Link to this post

    Hello Paul,

    Thank you for sharing you prism experience with us. Recently we blogged about how to create a custom prism adapter in case you want to use the RadDocking control and combine with the Prism framework. You can check the Miroslav's blog post, demonstrating some useful techniques.

    Greetings,
    Kaloyan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  18. Paul
    Paul avatar
    37 posts
    Member since:
    May 2009

    Posted 22 Sep 2009 Link to this post

    Kaloyan, thanks for the heads up on Miroslav's post, that will definitely help.  Thx, Paul from Minneapolis
  19. Paul
    Paul avatar
    37 posts
    Member since:
    May 2009

    Posted 23 Sep 2009 Link to this post

    Kaloyan,

    Maybe you can forward my question to Miroslav if you're not sure of the answer..

    I looked at the custom Region Adapter Miroslav built.  What I find interesting is that he is using a radPane for both the Document Host and the normal Docking control. I thought the Document Host needed a radDocumentPane ... does radDocumentPane inherit from radPane and that's why it works?

    I need to dynamically add both radPanes and radPaneDocuments at runtime.  This is based upon a lookup to a web service to see what modules the user has been granted access to and then load them.
     
    Note that I haven't tested this thoroughly and will be in the coming week.

    My custom Region adapter tries to handle both radPanes and radPaneDocuments types by branching on the value of the Tag property from the incoming module control (an ugly workaround I know). For example, the Add action code block is as thus:

     

    string ModuleTag = CurrentElement.Tag.ToString();

     

     

    UserControl CurrentElementAsUserControl = CurrentElement as UserControl;

     

     

    string[] paramModule = ModuleTag.Split(';');

     

     

    switch (paramModule[0])

     

    {

     

    case "multipane": //pane gets added to existing RadPanegroup

     

     

    RadPane PaneToAdd = new RadPane();

     

     

    //embed the content

     

    PaneToAdd.Content = CurrentElementAsUserControl;

     

    //make sure any data bindings are maintained

     

    PaneToAdd.DataContext = CurrentElementAsUserControl.DataContext;

    regionTarget.AddItem(PaneToAdd,

    DockPosition.Left);

     

     

    break;

     

     

    case "docpane": //pane gets added to existing RadPaneGroup inside of document host

     

     

    RadDocumentPane DocPaneToAdd = new RadDocumentPane();

     

     

    //embed the content

     

    DocPaneToAdd.Content = CurrentElementAsUserControl;

     

    //make sure any data bindings are maintained

     

    DocPaneToAdd.DataContext = CurrentElementAsUserControl.DataContext;

    regionTarget.AddItem(DocPaneToAdd,

    DockPosition.Left);

     

     

    break;

     

     

    default:

     

     

    //unknown type of module to embed

     

     

    break;

     

    }


    Also note that if the module has existing data bindings they need to be maintained via assignment of the DataContext property.

    Does this look sane to you?

    Regards,
    Paul from Minneapolis
  20. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 25 Sep 2009 Link to this post

    Hi Paul,

    The code looks OK. As you correctly noticed the RadDocumentPane inherits from RadPane and in this time there is not difference between them. In future the DocumentPane will have some more features, but at this time it just inherits from RadPane.

    I would suggest using RadPanes (or RadDocumentPanes or both) instead of UserControls for two reasons - you won't need to create instances of RadPane or RadDocumentPane in the code of the Add method and you won't need to pass the type of the pane in the Tag property of the UserControl - you will be able to inherit from RadPane or from RadDocumentPane (instead from UserControl).

    Regards,
    Miroslav Nedyalkov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  21. Paul
    Paul avatar
    37 posts
    Member since:
    May 2009

    Posted 25 Sep 2009 Link to this post

    Miroslav,

    Thanks for the prompt reply.  And thanks for the suggestions.

    My implementation of Prism is more aggressive than the normal...I'm not placing the same views into the regions every time.  Upon launch I check a WCF service to validate the user in the system, then I return back a list of modules that user has access for (which becomes the catalog).  Then, upon first use, I place the view modules into a default layout.  The users can modify the layout via a layout preferences dialog that the user can place their views in the appropriate panes and save the layout (both back to the wcf service and to local isolated storage).  Then the next time they load, I restore that layout with the views in that positions.

    What I'm shooting for is the ability for the application admins to grant user access to modules and load them at run-time.  This is because I have users with different needs and requirements.

    Thanks again,
    Paul from Minneapolis
  22. Paul
    Paul avatar
    37 posts
    Member since:
    May 2009

    Posted 30 Sep 2009 Link to this post

    Miroslav / Kaloyan,

    I have some fundamental questions using Prism with the docking control.  In Miroslav's example the radPane is used to insert into the radPaneGroups regions which static.

    In a proof of concept I built for the customer using SketchFlow and the radDocking control, they have multiple module apps (Views) they'd like to have loaded at run-time.

    I have three types of regions:
    1. a radPaneGroup docked top as a region that I can dynamically add the radPanes as needed
    2. a radPaneGroup nested within the radDocumentHost / radSplitContainer.  I add radPanes to this as needed as well.
    3. a left and a right radSplitContainer that is a region that I can dynamically add a radPane, wrapping it in its own radPaneGroup on the fly inside the RegionAdapter.

    The first two types can be handled by the radPaneGroup region adapter.

    In the third region type, they like the ability to treat each tool with it's own pin and dock it to the side as a Auto-hide tab or display it as a docked pane (in the radSplitContainer).  A main desire is that, upon app startup, determine what tools (as app modules) the user has access to and load them into their own radPaneGroup on the left or right (as tabs).  For this I will hit a WCF web service to get the user's catalog info from a database (an application admin will have a screen to assign/remove user permissions to the various app modules).

    Do you anticipate problems with trying to make the radSplitContainer a region?   I've debated having my app modules have as the top-level element as either:
    • radPaneGroups or
    • radPanes and dynamically wrap/unwrap them with radPaneGroups on the fly which one seems the better approach to you?

    I've created a region adapter with the following class defintion:

       public

     

    class RadSplitContainerRegionAdapter : RegionAdapterBase<RadSplitContainer>

     


    Another question: it'd be nice if the docking control save/restore layout would handle the layout state of all these dynamic app modules, but I haven't gotten to where I can try it yet.  Would you think it would still function under this approach or should I roll my own save/restore functionality (region position and docking state of the various modules)?

    i'm looking for your gut answers on this, don't take the time to proof this out ... unless you really feel you must. ;)

    Thanks,
    Paul from Minneapolis
  23. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 01 Oct 2009 Link to this post

    Hello Paul,

    I don't see any problems to create region adapter for the RadSplitContainer control and to use the RadSplitContainer control as a region. There is one thing you should notice in this scenario - the groups you add dynamically are not removed automatically so you should take care of them, too. The problem here is that when the user drags the panes around some panes that are not initially in a particular group can be moved to it and when you remove the pane, that added the group, the group might not be empty and shouldn't be removed.

    We may consider adding methods for adding panes in a SplitContainer that will add groups automatically and mark the group as auto generated and this group will be recycled automatically when not needed any more. This is already done for the groups that are created when you drag and drop panes.

    All the best,
    Miroslav Nedyalkov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  24. Paul
    Paul avatar
    37 posts
    Member since:
    May 2009

    Posted 01 Oct 2009 Link to this post

    Miroslav,

    For Prism-based applications especially, this is a good idea...
    "We may consider adding methods for adding panes in a SplitContainer that will add groups automatically and mark the group as auto generated and this group will be recycled automatically when not needed any more. This is already done for the groups that are created when you drag and drop panes."

    This simplifies things for folks like me who are trying to provide a reusable application framework for their organization.  It then becomes a single UI interface specification for which to create app modules:  they only need to buy the radControls, wrap it in a radPane and focus on the specifics of their implementation.

    Thanks again. I appreciate your quick response,
    Paul from Minneapolis
  25. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 01 Oct 2009 Link to this post

    Hello Paul,

    This is the idea of the Docking control - to help you concentrate on your application specific logic.

    For now you could generate the groups yourself in the SplitContainer region adapter.

    Regards,
    Miroslav Nedyalkov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  26. Stephen
    Stephen avatar
    23 posts
    Member since:
    Jan 2008

    Posted 11 Dec 2009 Link to this post

    Hi,

    I bumped my head against this problem - ie you cannot use view injection when using the RadPaneGroup within a DocumentHost, which I really need to do.

    I found the answer to doing this here;
    http://compositewpf.codeplex.com/Thread/View.aspx?ThreadId=51602

    What you need to do is expose the IRegionManager as a property on the Shell or the presentation model backing the Shell, then bind to it.  Your DocumentHost should look as follows;

    <

     

    telerikDocking:RadDocking.DocumentHost>
    <telerikDocking:RadSplitContainer>
    <telerikDocking:RadPaneGroup x:Name="RadPaneGroupDockingAreaRegion" Regions:RegionManager.RegionName="DockingAreaRegion" Regions:RegionManager.RegionManager="{Binding Path=RegionManager}" />
    </telerikDocking:RadSplitContainer>
    </telerikDocking:RadDocking.DocumentHost>

     

    You should now be able to use the region with view injection.

    Hope that helps some folks

    Zack


  27. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 14 Dec 2009 Link to this post

    Hi Zack,

     Thank you for your suggestion! We were able to fix the issue for WPF, but unfortunately the problem still exists in Silverlight. Your work-around will help for sure. I updated your Telerik points.

    Just one comment - as Prims is walking the Visual tree, you could put the binding only to the top-level RadSplitContainer in the DocumentHost (that is directly set to the DocumentHost property). This way all the regions in the DocumentHost will be able to find their region - the region of the top-level RadSplitContainer in the DocumentHost area.


    Regards,
    Miroslav Nedyalkov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  28. Tim
    Tim avatar
    85 posts
    Member since:
    Aug 2008

    Posted 10 Mar 2010 Link to this post

    I've followed the solutions here but I still can't get this to work in Silverlight 3 with latest rad controls.  I am doing things slightly differently it seems because I do not want my modules to have to inherit from RadPane, RadGroupPane, etc.  Basically, I create the necessary controls at runtime, add a ContentControl or ItemsControl and set the region name on it.  However, after doing so, the Region never gets created!  I still don't understand why it doesn't because all I am telling Prism is that it needs to have a Region on the ContentControl that is set as the "Content" property of a RadPane. 

    I attached a project reference to the Prism libraries and it seems that the RadPane control is never firing the "Loaded" event for controls that are dynamically created at runtime.  Prism relies on this event so that it can create the prism regions on demand.  All other controls are firing this "Loaded" event anytime I am doing this (for example, I dynamically create an RadOutlookBarGroup and add some content area in it as a prism region and it works just fine).  I would say there is something wrong in the RadPane class but I am not sure where.
  29. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 11 Mar 2010 Link to this post

    Hello Tim,

     All the controls are firing their loaded events when they appear in the visual tree. If there is only one pane in a RadPaneGroup it hides its tab strip area (where the panes are displayed) and the pane never gets shown. On the other hand its content gets added to the visual tree and its loaded event is fired. If you have more than one pane in a pane group, the loaded event only of the selected pane will be fired, because the content of all other panes is actually not visible (a similar thing happens when you use tab control). When the user selects another pane, its content gets added to the visual tree and the content of the previous one is removed from it.

    Hope this information is helpful!

    About the problem you are experiencing - you said that you are attaching a project, but unfortunately there is no attachment. Could you please open a support ticket and send the project you mentioned (you cannot attach .zip files in a forum thread)? This will help up find what the problem is and better assist you to resolve it.

    Sincerely yours,
    Miroslav Nedyalkov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  30. Tim
    Tim avatar
    85 posts
    Member since:
    Aug 2008

    Posted 11 Mar 2010 Link to this post

    Sorry, bad wording on my part, I meant "added a project reference" to Prism.  I had to go back to using the SandDock controls for now because they work flawlessly with my scenario and prism.  I understand completely about what you're saying about the Loaded events.  However, I do see the tabs even though there is only one RadDocumentPane added to the DocumentHost.  I can watch prism attach to the Loaded event of the "ItemsControl" I am added to the pane but the loaded event on that control is never raised (even though the pane is the only one on the Tab area and it is completely visible).  I will try to look into this more and see if I can see what's happening and maybe attach a sample project.
  31. Justin Brown
    Justin Brown avatar
    3 posts
    Member since:
    Nov 2009

    Posted 07 Apr 2010 Link to this post

    A quick fix for this is explicitly setting the RegionManager property on the DocumentHost in the View's constructor like this:

     
    _documentHost.SetValue(RegionManager.RegionManagerProperty, regionManager);  

    Unity can provide the region manager by adding it as a parameter to the constructor.

    Cheers,
    Justin

Back to Top
DevCraft banner