O'Reilly logo

XAML Unleashed by Adam Nathan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Styles

A style, represented by the Style class, is a simple entity. It groups together property values that could otherwise be set individually. The intent is to then share this group of values among multiple elements. There are examples in this book in which property values are duplicated on multiple elements. Using a Style to avoid the duplication is a much cleaner approach.

Take, for example, the three customized Buttons in Figure 18.1. This look is achieved by setting seven properties. Without a Style, you would need to duplicate these identical assignments on all three Buttons as follows:

<Page ...>  <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">    <StackPanel Margin="20" Orientation ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required