0

I have an application in PRISM, C#, and I wonder if I can do the following:

I've a button bar on the bottom of my appliction, which acts as my navigation area. The user can click on button A, and the dashboard of module A will pop up.

The user clicks on an item in the dashboard, and he comes to a details page about the item. He is in the pogress of making some changes, but he receives an email during this process.

He opens module B and makes a new item in module B.

--> There are 2 instances open at that moment, the details page of module A, and the add page of module B. I want the user to also visualy pick up on this, because there will be a "1" above the button for module A.

The question is, (how) can I do this with PRISM.

tl;dr; Does PRISM support multiple instanciated views? (it's the "managing" of open views, so you can chose which view to have open.)

I tried googling this, but I couldn't find anything related to it (probably because I'm not sure of how to call this, so I can't search on it :/)

Any info is much appreciated, thanks for your time.

Team-JoKi
  • 1,766
  • 3
  • 15
  • 23

2 Answers2

2

Here's a very short intro on how this works out in Prism, including links to an unbelievably helpful section of MSDN:

Prism has regions, which is an abstraction for controls that can host one or more other controls (your views). Each region can have any number of views added to it, and at most one view in each region is active. The manner in which views (including what it means to be the active view) are displayed is dependent on the region adapter, which is an object created automatically by Prism based on what type of control hosts each region.

Jon
  • 428,835
  • 81
  • 738
  • 806
0

Adding to Jon's post.

You might want to use TabControl. If you put PRISM's region into TABCOntrol - you will be able to see all instances as tabs.

You can see decent sample with some XAML on how to close tabs here: Menu service in Prism application CAL

So, on "inside" - PRISM will have either singleton views/viewmodels if you Export them with MEF by default. If you export those parts as NonShared - PRISM will keep multiple versions of same view inside container (MEF or Unity). However, with buttons - you won't get specific instance.

So, use TabControl as container like this: Menu service in Prism application CAL

Or you can write your own region adapter and track instances in there.

Community
  • 1
  • 1
katit
  • 17,375
  • 35
  • 128
  • 256