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 Buttons, 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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.