Popup Modal to current Tab

Topics: Prism v2 - Silverlight 3
Oct 5, 2009 at 7:52 PM

I have a TabControl as my main region adapter and each view is loaded in a new tab.  I need to be able to open a new view as a popup/childwindow but have it modal to the current tab only.

Ex:  User has Order 1 and Order 2 open in two different tabs.  If the user is on Order 1 and clicks the Add Item button which opens a popup/window with the AddItem view centered in the Order 1 tab.  The user still wants to be able to click over to Order 2 even thow a "window" is open in the tab for Order 1.  The user should not be able to do anything else on Order 1 until the AddItem window is closed.

How would I do this?

Oct 7, 2009 at 4:26 PM

Is this possible?  Am I asking something that is really simple or impossible?

Oct 8, 2009 at 6:25 PM

OK, so I thought I had a solution working but am now thinking I might have mis-understood scoped regions.

What I tried doing was having each view that is added to the tab control that contains a nested region create a scoped region manager during the add.  I have ViewA, which is being added to my main (tabcontrol) region that has a nested region defined called "popregion".  When ViewA is added to the main/tabcontrol region I do a newscreenobj.RegionManager=_mainregion.Add(viewa, uniquename, true) where newscreenobj is kept in a collection of open views (via a screen controller object).  Then when the popup view (ViewP) is requested I do a _owningscreenobj.RegionManager(specifiedregion).Add(new viewp) followed by a .Activate(viewp).  This works great if I only have ONE of ViewA open.  If I have more than one ViewA open the popup view is always displayed in the last instance of ViewA.

Can I create more than one scoped region of the same name for different instances of the same view?

Any help is appreciated!!!!!

 

Oct 9, 2009 at 8:03 AM

This might be a daft suggestion because of screen/view size differences, but couldn't the Order View transition into the add item? Something similar to the way the Stock Trader RI rotates when you click between Position and Watch List. This way you just have one view that changes state. Hope that makes sense.

Just a thought.

Oct 9, 2009 at 11:42 AM

Its a thought I'm kicking around already.  The problem is the screen (or one of them) that I want to "pop up" is a generic screen that potentially would be accessed in a similar manner from other edit screens (ex: Select Part) and ideally I'd like other edit views to just be able to call it the same way rather than always embedding in the view.  In addition, I might have 2-3 different views I want to pop up based on user actions and I was trying not to load all those view up unless they were needed.

That being said, your suggestion at the moment is the only way I can get this to work so I might just have to go down that road.  My product mgr does not want to use the Child Window approach and have the entire application disabled when one of these windows is requested, they only want the currently selected tab contents "disabled".

Thanks for the thought.

Oct 9, 2009 at 12:30 PM
Another thought. How about if you create a generic shell with a single region you can insert a view into? Then when you display this shell to add a new item, disable the current order view. The order view is then only enabled when the user has finished with the new item shell. If the user clicks on the second order the new shell window will go behind the current orders shell window. If the user then goes back to the first order you can detect that it's in a "adding item" state and reshow (bring to the front) the add item shell window. Obviously you'll have to be careful to trap the OnClosing of the new shell window to enable the order view again :)
Oct 9, 2009 at 12:37 PM

Unfortunately I don't think that will work as they want to be able to have a pop-up window open in more than one tab at at time.