Region to view ratio guidelines

Topics: Prism v2 - Silverlight 2
May 19, 2009 at 2:38 PM

Are there any guidelines for a region to view ratio? In other words, is it best to have one view per region or we can have more (say 5 or 10).

Would it just depend on our application and our requirements?

May 19, 2009 at 2:41 PM

That depends. If your region is like a Selector control (Tab control), then you can have as many views as possible. For a Content or Items region, I think you can have only one view per region.

Hope it's right and answers your query.

 

May 20, 2009 at 3:47 PM

Thanks Osei.

Im adding a collection of views to a listbox. This list box is inside a region. Would this scenario be valid?

May 20, 2009 at 6:40 PM

I don't quite understand your scenario but I would suggest looking into scoped regions. Are you displaying the views inside the listbox? Are the number of views known at design time or dynamic at run-time??

May 20, 2009 at 7:51 PM

Hi winrunner,

 

A couple of days ago there was a discussion tightly related to this topic. Perhaps you could find it enriching:

·         Best way to manage views in a region 

 

As you are adding view to a listbox (adapted by prism by the SelectorRegionAdapter), when you add a view to the region, it will be added as an item to the listbox. So in this scenario it makes sense to have several views in the same region.

 

Keep in mind that if other modules won't add views to the region, you might not even need to attach a region to the listbox. As Osei said, scoped regions might be a good option in some scenarios. These are some discussions related to these topic:

·         Multiple Views

·         Architecture of sub controls in regions

 

Hope it helps!

 

Matias Bonaventura

http://blogs.southworks.net/matiasb