ResourceDictionary in WP7

27 Sep

WP7 is based on Silverlight 3+ and by default it’s not possible to create a new resource dictionary. However it’s pretty easy to work around – just follow the same guidelines as if it was in Silverlight 3.

1) Create a new Class and rename it YourResourceDictionary.xaml (or whatever fits you).

2) Replace the content from the Class with the content you need:

xmlns:x=”” >
<!– Your resources goes here –>

3) Unless you’re creating a Generic.xaml resource dictionary in the Themes folder you need to add the resource dictionary to the list of merged resource dictionaries in your App.xaml file:

<ResourceDictionary Source=”YourResourceDictionary.xaml” />

Your resource dictionary will now be loaded as part of the application resources to your WP7 application.

by xamlgeek

Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s

%d bloggers like this: