You are here:   Blog
Register   |  Login

 

 

How to Access Static Resources From Code

Sep 12

Written by:
Monday, September 12, 2011  RssIcon

  • VB:

  • Dim Body = New TextBlock() With

        {

              .TextWrapping = TextWrapping.Wrap

            , .Style = CType(App.Current.Resources("ResourceName"), Style)

        }

  • C#:

  • var Body = new TextBlock() 

        { 

              TextWrapping = TextWrapping.Wrap

            , Style = (Style)App.Current.Resources["ResourceName"] 

        };

Tags:
Categories:

Your name:
Gravatar Preview
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Security Code
CAPTCHA image
Enter the code shown above in the box below
Add Comment   Cancel