Using a Base TargetType
Although the Style
in Figure 17.1 is shared among three Button
s, it can be shared by any kind of Control
if you mark it with TargetType="Control"
instead:
<Page ...> ... <Style x:Key="PurpleTiltStyle" TargetType ="Control"> ... <Button Style="{StaticResource PurpleTiltStyle}" Content="1"/> <ToggleSwitch Style="{StaticResource PurpleTiltStyle}"/> <ProgressRing IsActive="True" Style="{StaticResource PurpleTiltStyle}"/> ... </Page>
The result is shown in Figure 17.2. Note that ToggleSwitch
’s default appearance enforces a minimum width, so it ignores the Style
’s Width
setting.
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.