At last nights Triangle .Net User Group meeting, during the opening code sharing session I showed one of the demos from www.silverlight.net site. (If you are doing anything with Silverlight, or wanting to understand more of what Silverlight can do this site is a must!)
One of the videos posted by Laurence Moroney shows the use of using query string parameters to generate dynamic Silverlight XAML. There is a VIDEO and the original sample here: http://silverlight.net/learn/learnvideo.aspx?video=113
I modified the original demo to also dynamically modify an image control to display the appropriate flag of the country of the customer queried from the NorthWind database.
To do this I simply added an image tag and placeholder information to the XAML template:
<Image x:Name="imgCountry" Source="images/ms.jpg" Width="155" Height="155" Canvas.Left="8" Canvas.Top="72">
I then modified the code in the data.aspx.cs file to include:
xNode = xmlDoc.SelectSingleNode("//d:Image[@x:Name='imgCountry']", mng);
xNode.Attributes["Source"].Value = "images/" + myReader["Country"].ToString() + ".jpg";
These changes instruct the Silverlight template to point to the appropriate flag image. I downloaded a number of flag images from wikipedia.
I further modified the XAML template to include a basic animation of the flag that results in the following (XAML template is here)