Creating a PRISM region adapter for RadTabControl

3 posts, 0 answers
  1. Anthony
    Anthony avatar
    3 posts
    Member since:
    Dec 2017

    Posted 12 Mar 2018 Link to this post

    I am converting a .NET 1.1 Windows Form (mdi) based application to a WPF which is using PRISM as its MVVM framework.  

    To simulate the mdi behavior, the application needs the ability to open multiple tabs for same view.  For example, I have a view displays the person’s name, address, phone, etc.

    I used your CustomTabControlRegionAdapter_WPF project as guidance for  creating the region adapter for the RadTabControl.  This seemed to work until the TabItem view contains another TabsControl.  To ensure it wasn’t something specific with my implementation, I reproduced the behavior in your sample project.

    In the TabItemHomeView.xaml , I added the another TabControl:

    <TextBlock Text="This is the Home tab content" /><br><telerik:RadTabControl><br><telerik:RadTabItem Header="Tab 1"></telerik:RadTabItem><br>       <telerik:RadTabItem Header="Tab 2"></telerik:RadTabItem><br>       <telerik:RadTabItem Header="Tab 3"></telerik:RadTabItem><br></telerik:RadTabControl>


    When the project runs, it  throws an exception on line 215 of the RadTabControlRegionSyncBehavors.cs:  “The region does not contain the specified view.”  Parameter name: view;

    Any additional guidance would be appreciated.

    Thanks

  2. Anthony
    Anthony avatar
    3 posts
    Member since:
    Dec 2017

    Posted 13 Mar 2018 in reply to Anthony Link to this post

    I may have identified the fix; however, at this point I don't know if there are any open issues.   I looked at the source code for the PRISM SelectorItemsSourceSyncBehavior.cs to compare the differences.  

     

    I replaced line 215: if (!this.Region.ActiveViews.Contains(item))

    with    if (this.Region.Views.Contains(item) && !this.Region.ActiveViews.Contains(item))

     

    Now that I have been able to create multiple tabs, I feel the TabControl is the wrong control for the top level container.  I no only want to give the user the ability to open up multiple tab, but also to close the tabs and undock them so it behaves like a stand-alone window.   

    The RadDocking control seems more appropriate.  I am reviewing the ShellPrism_WPF project in the Docking_WPF solution for PRISM guidance.

     

    Thanks

     

  3. Petar Mladenov
    Admin
    Petar Mladenov avatar
    3100 posts

    Posted 15 Mar 2018 Link to this post

    Hello Anthony,

    I am glad to hear you have resolved the exception on your own. Indeed, our example is not well suited for nested TabControls. As for the Docking - yes it is more appropriate when it comes to dock/undock (arrange), float a tab into window, drag-drop operations, closing tabs. In addition to the mentioned sample ShellPrism you can take a look at the following blog post:

    How To Use RadDocking with PRISM in WPF / SIlverlight

    Regards,
    Petar Mladenov
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Back to Top