Sunday, 19 June 2011

Dynamic UI in Silverlight

Sometimes you may need a UI that’s dynamically loaded perhaps from meta data stored in a database or some other repository.  There are two ways to do this in Silverlight code:

1) Create the .Net objects and attach them to the relevant LayoutRoot

2) Create a block of raw Xaml and load that into the relevant LayoutRoot

Here’s an example of a page that can use both methods to produce a simple bar chart:


Perhaps this is not the most visually stunning example but you can apply this technique to dynamically build your UI forms with textboxes and combos in a similar fashion to MVC scaffolding.

The Code

To download the source code click here:

No comments:

Post a Comment