App-wide Font resources in Silverlight -


i'm looking see if possible use app-wide font in silverlight controls can set in application.resources , used throughout app. don't need specifify other things font bold or italic, name.

mostly, custom fonts require embedded app. example, i'm looking simple (not of particular control or control type)...

<setter x:key="my first font"         property="fontfamily"         value="vinertic.ttf#viner hand itc" /> 

then in given control type...

<textblock fontfamily="{staticresource "my first font"}"            x:name="applicationtitle"            text="next page" foreground="red"/> 

...or...

fontfamily="{binding "my first font"}" 

or such thing.

i know did doesn't work, desired effect.

i can't seem find documention on how set app-wide font families. advice?

here information think started.

first off, easiest way know embed font in shared library (ex: silverlight class library), following:

  1. have class library, , know default namespace. example, default namespace of class library common.windows.
  2. have font. example, action man bold.ttf, contains named font action man.
  3. add font somewhere in shared library project. example, assets/fonts folder.
  4. set build action on file resource.
  5. build project.

after following these steps, can refer font wherever please, including styles, syntax similar text block below:

<textblock  fontfamily="/common.windows;component/assets/fonts/action man bold.ttf#action man" /> 

note fontfamily expression above worked within container project and within referencing project. didn't test process zip archive of fonts, i'd bet fancy rock out of garden still work.

that should started. if interested in going (and useful) step of declaring font in style, , using style on controls, consider taking @ resource:

http://www.silverlight.net/learn/quickstarts/control-styles/


Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -