In this article we will see how we can manage Styles
in different files. Resource Dictionary is a cool feature available in Blend 3,
where we can store our defined styles.
Fire up Blend 3 and create a Silverlight Application. Name it
will do the simple thing, customizing a Button Control.
Add a Button to
the Application. Right Click on it and choose Edit Template and then choose Edit
you choose Edit a Copy a new dialog box pops up saying Create Style
First of all Name the Style for Example
Then you have Define option under that we have three
choices to make to store the Style information.
default is under This Document which will store under the Page's xaml code
The Application option will store the Style information in
The third option is grayed, as there is no Resource
Dictionary. We will use the Resource Dictionary option.
Create a new
Resource Dictionary by clicking New.
asks for giving a name to the file. You can see the extension is
Now the Resource Dictionary option will be activated with proper
ok to continue with our work.
You can see a new file named
ResourceDictionary2.xaml added to the Project. As it has only Style information
so there is no code behind for it.
have done simple change to the Button. (I have changed the Background Gradient
we have finished editing the Template, exit editing template.
App.xaml in xaml code behind you will find the Resource Dictionary is added to
the Application Resource.
If you see the Button Control in xaml code behind, you will find the Style is Bound to the Name you have given for the Style.
Now if you open the Resource Dictionary in xaml code behind you will find the Styles you have just changed.
That's it you have successfully used
Resource Dictionary In Silverlight 3 using Blend 3.