Delivering Parameterized Silverlight Content with ASP.NET - Silverlight.Net Sample

Friday, September 14, 2007 1:21:55 AM (GMT Daylight Time, UTC+01:00)

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)

image

Technorati Tags: , ,

Posted in Silverlight  | Comments [1] 


Saturday, May 23, 2009 3:32:08 PM (GMT Daylight Time, UTC+01:00)
Hi guys. The best of us must sometimes eat our words. Help me! Looking for sites on: Turbo Tax. I found only this - <a href="http://turbo-tax.biz">turbo tax</a>. Features include a searchable addiction links database, database. Apr a national survey on drug use and health short report highlighting alcohol treatment - need, utilization, and barriers, substance abuse and. With love :mad:, Rayna from Uzbekistan.
Comments are closed.