Create Multiple TAB Instances of Views and their architecture

Topics: Prism v2 - WPF 3.5, Prism v2 - WPF 4, Prism v4 - Silverlight 4, Prism v4 - WPF 4
Jun 24, 2013 at 2:54 PM
Edited Jun 24, 2013 at 3:29 PM

I have a Tab control , in which tab item must be generated dynamically (i.e. when I click some button need to add tab item with region ) .

We have a WPF UI , where in there are multiple regions.

1.Top region where we have the search functionaility (we can have an expander to close/open)
  1. To the Left we have Tab region, where we have to load the Tabs dynamicallay I mean
    Once a view gets opened in One tab , clicking on the link present on that Tab should load another View (A1) as a TabA1 .
    If user clicks on another link , another Tab should Open (same View) but another instance View(A2) .
    And we have Comments region to the extreme right .
  2. We have status bar in the below .
    The Tab region,NOtes,are all dockable .
    How can we start with architecture, How many regions , How can we load multiple tabs. please suggest .
How can I achieve this functionality using Prism and MVVM.

Thanks and Regards
Jun 24, 2013 at 8:08 PM
Hi Deepak,

If you define your TabControl as a region, then each view you inject in it will be represented as a new tab. So basically, when you click the Button to add a view, the corresponding Command would be executed in the corresponding view model, adding the view to the region; for example, doing something like this:
this.regionManager.Regions["TabRegion"].Add( viewA1 );
this.regionManager.Regions["TabRegion"].Activate( viewA1 ); // Optional, if you want to select the viewA1 as the active tab 
The injected view should be automatically wrapped in a TabItem and added to the TabControl.

Please let us know if you have any doubts.

Damian Cherubini