Applying theme for silverlight controls


As we know we can create a rich UX using silverlight , i would like to share in this article on “how to apply themes to the silverligh controls“.

1. Download and install silverlight 4 for visual studio 2010, make sure the installtion is successfull.

2. Now Download silverlight 4 toolkit that contains SDK ,some samples, themes and documentations.

3.Navigate to “C:\Program Files (x86)\Microsoft SDKs\Silverlight\v4.0\Toolkit\Apr10” to see the contents of the toolkit.

4.Open the silverlight project and add reference to System.Windows.Controls.Theming.Toolkit.dll from bin folder.

5.Also add reference to the theme that you would like to apply for the controls (In this example i have considered reference to System.Windows.Controls.Theming.TwilightBlue.dll ).

6.Go to MainPage.xaml in the project and include the namespace in the UserControl section of the MainPage.xaml file.

xmlns:ThemeBlue=”clr-namespace:System.Windows.Controls.Theming;assembly=System.Windows.Controls.Theming.TwilightBlue”

7.Now add <ThemeBlue:TwilightBlueTheme> just before <Grid x:Name=”LayoutRoot” Background=”White”> and close the tag after Grid definiton.

Here is an example of the silverlight control(with theme) integrated with sharepoint.

Image

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s