Http://www.cnblogs.com/zhouyinhui/archive/2007/03/28/690993.html
Templates and Styles
They can adjust the properties of the control, but the style cannot replace the control's original appearance with a new visual tree that consists of different elements.
<window x:class="Applytemplatetocontrol.mainwindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="Http://schemas.microsoft.com/winfx/2006/xaml"Title="MainWindow"height=" $"Width=" -"><window.resources><controltemplate x:key="buttontemplate"Targettype="{x:type Button}"><border x:name="Border"Borderbrush="Orange"borderthickness="3"cornerradius="Ten"Background="Red"Textblock.foreground=" White"><grid><rectangle name="Focuscue"visibility="Hidden"Stroke="Black"strokethickness="1"strokedasharray="1 2"snapstodevicepixels="True"></rectangle><contentpresenter recognizesaccesskey="True"margin="{TemplateBinding Padding}"></contentpresenter></grid></border><controltemplate.triggers><trigger Property="IsMouseOver"Value="True"><setter targetname="Border"property="Background"Value="darkred"></setter></trigger><trigger property="ispressed"Value="True"><setter targetname="Border"property="Background"Value="indianred"></setter><setter targetname="Border"property="BorderBrush"Value="Darkkhaki"></setter></trigger><trigger property="iskeyboardfocused"Value="True"><setter targetname="Focuscue"property="Visibility"Value="Visible"></setter></trigger><trigger property="isenabled"Value="False"><setter targetname="Border"property="Background"Value="Mistyrose"></setter><setter targetname="Border"property="Textblock.foreground"Value="Gray"></setter></trigger></controltemplate.triggers></controltemplate></ Window.resources><stackpanel margin="5"><button x:name="btnwithtemplate"margin="5"padding="5"Content="Button with custom template (Click _me)"click="Btnwithtemplate_click"Horizontalalignment=" Left"Template="{StaticResource Buttontemplate}"></button><button margin="5"padding="5"Content="Button with default template"Horizontalalignment=" Right"></button><button x:name="btnreset"margin="5"padding="5"Content="Reset button with custom template"click="Btnreset_click"></Button></StackPanel></Window>
WPF ControlTemplate Control Templates