Embedded Regions Strategy #2429
Replies: 1 comment
-
BTW: trapping on IsNavigationTarget works. I introduced some code to detect the case that the form is being displayed for the first time. There are obviously some points in the TabControl video that I'd like to revisit to figure out where to go with this in the general case, but I am moving forward with my application development at this point.
ModelSubForm indicates that I'm building a framework. One of the requirements that I encounter in my application domain is the ability to provide "value-added" interfaces that expose features for "expert" users. One way to secure this is to have two modules, one each for the typical and expert user, and deliver the second to paying customers. In this case, the application needs to be able to load the modules and say "Hey, who knows how to configure a Location?" In other words, I am building a model-driven navigation framework. |
Beta Was this translation helpful? Give feedback.
-
I have an aggregate model class, and am composing forms for the embedded instances. Schematically:
For motivation, think of A as an Address and B as a Business with physical and mailing addresses.
In building the UserControl "ViewB" for B, I embed the UserControl for A in PRISM regions "RegionForA1inB" and "RegionForA2inB". Starting with myB1 I use "RegionForA1inB" to display myB1.myA1, etc., and all is well. Unfortunately, when I attempt to display myB2, RequestNavigate fails with myB2.myA1 because the "RegionForA1inB" already exists.
I have two hacks in mind for this, but having not found examples of this design, I thought that I'd ask first. As I only need a single instance of ViewB, I can trap INavigateAware.IsNavigationTarget and inject myA1 and myA2 into the ViewAViewModel instances, or I can trap OnNavigatedFrom in ViewBViewModel and delete the regions. The last seems dicey...
Beta Was this translation helpful? Give feedback.
All reactions