开发者

prism wpf: how to show views/modules in one region

I have a Shell class with one region. I created a module which shows,for example, a list of offices. When I choose one of offices I want to show another module where I want to transfer information about chosen office. Questions:

  • what is better: to create another module or maybe to create just another view in existing?
  • (if I still want to create second module), how do I must to change views in region?开发者_Python百科 Notice, I have only one region, so I need either hide view of first module or unload it.
  • What if I want to add one more region to shell? E.g. every module must contains 2 views and change all of them.

Thanks.


I'll try to answer the questions separately.

  1. If the information you are going to show is related to that of the list view (say the details of a particular office), the common approach would be creating another view in the same module. This is because both views are related to offices and share related concerns, so having a separate module for them brings more pain than gain.
  2. Whether you do decide to create a second module or not, if you want to only have a sinlge region in the Shell and display only a view at a time, you must use as a Region's host a ContentControl, which acts as a SingleActiveRegion.
  3. If you want to add more regions to the Shell, just add more controls and mark them with the RegionManager dependency property for regions. Many of the Prism quickstarts show this. To communicate between modules just use the EventAggregator.

I hope this helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜