Chapter 14. Resources, styles, and control templates

 

This chapter covers

  • Using application resources
  • Controlling styling
  • Building control templates
  • Using the Visual State Manager

Chapter 13 described the powerful animation features available in Silverlight. These features are useful for creating entertaining illustrations and for adding a degree of richness to your application. This richness can also be applied to controls, as you’ll see in this chapter.

Throughout this chapter, you’ll see how to apply rich styles to your application. These styles are similar to the CSS features you may have seen in the HTML world. In general, a Style declaration will be part of a resource, so I’ll cover resources first. From there, you’ll learn how to manage resources in dictionaries before moving on to creating rich visual Styles themselves. I’ll discuss both explicit and implicit styles. Then you’ll see how to expand on the definition of a Style to define a ControlTemplate, enabling you to redefine the visual structure of a Control. Once I’ve covered that subject, you’ll learn how to use the VisualStateManager to deliver engaging visual states and transition animations within your Control elements.

14.1. Being resourceful

14.2. Giving your elements style

14.3. Creating templates

14.4. Dealing with visual states

14.5. Sharing your visual states

14.6. Summary