Introducing Control Templates
ControlTemplate
can contain a custom tree of elements that defines a new appearance for any Control
. You can attach it to any Control
by setting it as a value for its Template
property. The following XAML adds a ControlTemplate
to one of two regular Button
s, producing the results shown in Figure 18.4:
<StackPanel Orientation="Horizontal"> <!-- A simple Button --> <Button Content="Without Custom Template"/> <!-- A Button with a custom ControlTemplate --> <Button Content="With Custom Template"> <Button.Template> <ControlTemplate> <Grid> <Ellipse Width="100" Height="100"> <Ellipse.Fill> <LinearGradientBrush StartPoint="0,0" EndPoint ...
Get XAML 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.