views:

260

answers:

0

I’m developing a composite Silverlight application using Prism. Part of the application is a highly configurable dashboard. A configuration file is downloaded by application through web service and the dashboard is constructed at runtime from the configuration file. Along with references to data sources and views (in terms of Prism), a configuration file also contains layout information. The core features of the described approach are already implemented using Prism and now I’m working on the implementation of layout configuration. By layout I mean the relative position of views on a dashboard. So far I decided to use grid for the layout. The configuration file defines regions in a grid (column, row) and the views are then injected into defined regions. Consider the following layout configuration:

  <row size = "*"/>
  <row size = "*"/>
  <column size = "*"/>
  <column size = "*"/>

  <region name = "region1" row = "1" column = "1"/>
  <region name = "region2" row = "2" column = "2"/>

  <view name = "gauge1" region ="region1">
  <view name = "gauge2" region ="region2">

It is obvious that the configuration showed above can be easily translated into xaml using Grid with regions in cells. So my question is what in your opinion is the best way to implement the described approach using regions and views in Prism? Is it better to add Grid rows and columns at runtime and add regions to cells or define custom region adapter based on Grid?