(X) Hide this
    • Login
    • Join
      • Say No Bots Generate New Image
        By clicking 'Register' you accept the terms of use .
        Login with Facebook

Tip: How to declare static resources in the scope of a Silverlight application?

(0 votes)
Denislav Savkov
>
Denislav Savkov
Joined Feb 11, 2008
Articles:   14
Comments:   6
More Articles
0 comments   /   posted on Sep 02, 2008
Categories:   General

Application static resources are used to declare instances of objects that should be alive and reusable throughout the whole life of an application. Usually as static resources are declared such things as styles, templates etc. Thus they can be used multiple times from multiple places within your Silverlight application.

Xaml

 <Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
               xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
               x:Class="SnackBites.App"
               xmlns:local="clr-namespace:Bomb">
      <Application.Resources>
              <Style x:Name="simpleStyle" TargetType="Button">
                  <Setter Property="Content" Value="Static style content"></Setter>
              </Style>
      </Application.Resources>
  </Application>
Note that for each resource you declare x:Name or x:Key should be specified!
That's it!

Subscribe

Comments

No comments

Add Comment

Login to comment:
  *      *       
Login with Facebook