From: http://www.th7.cn/Program/WPF/2011/12/21/51676.shtml
The ControlTemplate is used to describe the control itself. Use TemplateBinding to bind properties of the control itself, such as{TemplateBinding Background}The DataTemplate is used to describe the content of the control. Use binding to bind the properties of a data object, such as{Binding PersonName}In general, there is a contentpresenter in ControlTemplate, this ContentPresenter contenttemplate is the DataTemplate type control type- Template property (ControlTemplate type)-contentpresenter-contenttemplate (datatemplate type) ContentControl Type-template property (Co Ntroltemplate types) inherit from Control-contenttemplate (datatemplate type) ItemsControl Type-template property (ControlTemplate type) inherits from Contr Ol-itemspanel Property (itemspaneltemplate type) specifies the layout container-ItemTemplate property (datetemplate type) each item's template<Style TargetType="Button" ><Setter Property="Overridesdefaultstyle" Value="True"/><Setter Property="Template" ><Setter.value><ControlTemplate TargetType="Button" ><Grid><Ellipse Fill="{TemplateBinding Background} "/><ContentPresenter HorizontalAlignment="Center" verticalalignment = "Center"/> </grid> </< span class= "xml" >controltemplate> </setter.value> </ Setter></Style>
WPF control templates and data templates-tipsy rooms