Another use of resources is style settings:
< Window >
< Window. Resources >
< Style X: Key = " Mystyle " Targettype = " {X: Type textblock} " >
< Setter Property = " Verticalalignment " Value = " Center " />
< Setter Property = " Fontweight " Value = " Bold " />
< Setter Property = " Fontstyle " Value = " Italic " />
</ Style >
</ Window. Resources >
< Dockpanel >
< Stackpanel >
< Textblock Style = " {Staticresource mystyle} " > Name: </ Textblock >
< Textbox text = " {Binding Path = Name} " />
< Textblock Style = " {Staticresource mystyle} " > NICK: </ Textblock >
< Textbox text = " {Binding Path = Nick} " />
</ Stackpanel >
</ Dockpanel >
</ Window >
CodeIt is easy to understand. Remember to use setter to define each style. Pay attention to specifying X: key, and specify the style in the control if any style needs to be applied. If X: key is not specified, all controls use this style (of course, they do not set the style for the control ).="{Staticresource mystyle}").