Styles
A style, represented by the Windows.UI.Xaml.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 Button
s in Figure 17.1. This look is achieved by setting seven properties. Without a Style
, you would need to duplicate these identical assignments on all three Button
s as follows:
<Page ...> <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> <StackPanel Margin ...
Get Universal Windows® Apps with XAML and C# Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.