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

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 ...

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