.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> Silverlight >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Reduce Silverlight application xap size

Posted By:Diptimaya Patra       Posted Date: March 30, 2010    Points: 25    Category: Silverlight    URL: http://www.dotnetspark.com  

In this article we will see how we can reduce Silverlight application xap size. As you know themes are provided by Silverlight Toolkit. But if you include multiple themes your application would be too big.
 

Introduction

In this article we will see how we can reduce Silverlight application xap size. As you know themes are provided by Silverlight Toolkit. But if you include multiple themes your application would be too big.

Finding Silverlight Themes In Local Drive

Once you install Silverlight Toolkit, all the theme styles are copied to your local folder. You can find it in following path: 

C:\Program Files\Microsoft SDKs\Silverlight\v3.0\Toolkit\Jul09\Themes

Now suppose you need a theme style from Shiny Red a Shiny Blue for two different Buttons.

Open the related xaml in Visual Studio IDE.

Search for Button and you will be navigated to Button Style.

Copy the Button Style to your App.xaml.

Don't forget to copy the namespaces too.

xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"

Give a x:Key value to the Style in our case BlueStyle and RedStyle.

Copy the StaticResource constants and change the key appropriately. (You have change it carefully where you are using it.)

Here is the Xaml for the blue theme style buttons.


  
  #FFBAE4FF
  #FF398FDF
  #FF006DD4
  #FF0A3E69
  #FFBBBBBB
  #FF737373
  #FF646464
  #FF000000
 
  #FFBBBBBB
  #FF737373
  #FF646464
  #FFA1A1A1
 
  #FF3F3F3F
  #FFADADAD
 
  #FF62676A
  #FFD1D4D6
  #FFFFFFFF
 
  
  
  
  
   
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
   
 
  
  
  


Now open the solution in Expression Blend 3.

Add two Buttons to the Application.

Select First Button and Apply the Style.

1.gif

Simlarly you can use the Red themer and apply it to the Red Button.

Now you need to change the Static Resource names carefully where it is being used and declared.

Now it's ready. Run your application, it will run faster than before.

2.gif

Hope you like this tweak.

 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend