This article mainly involves reprinting and excerpt (for example, mrfangzheng's blog post in the yard). The existing articles have already been clear and do not need to be repeated.
1.A ControlTemplate is used to define/change the way a class derived from Control looks, such as Buttons, ListBox, ScrollBar. however, some "Controls" you use are not derived from Control: Best example is the TextBlock class. the TextBlock cannot have a ControlTemplate.
2.DataTemplate is closelly linked with the "Content" in WPF. certain controls are made to display "Content ". content can be anything, such as Image, Text, Object .... in fact, it is defined as an "object" type. the DataTemplate simply defines how a participant content (or content type) is meant to be displayed.
3.HierarchicalDataTemplate is an extension of DataTemplate with an additional ItemSource property. It is used to render hierarchical data in controls like treeview or menu.
Example: Usually, a string is displayed using a simple TextBlock... however, if you want a custom text layout, decoration, alignement ,... you wowould need to define an Alternate ememplate.
1.ControlTemplate is used to specify the visual structure, behavior, and Trigger that can be shared among multiple Control instances. Unlike creating a custom control, in many cases, you do not need to write your own control. You just want to change the visualization of the control or replace the ControlTemplate of the existing control. It is easy to use ControlTemplate. You only need to set it and assign it to the Template attribute.
2.DataTemplate is used to describe the visual structure of data objects. DataTemplate is usually used to specify the intuitive representation of data. It is easy to use DataTemplate. You only need to set it and assign values to the CellTemplate, ContentTemplate, and ItemTemplate attributes.
1.ControlTemplate is used to describe the visual style and behavior of the control. You can use TemplateBinding to bind the attributes of the control, for example, {TemplateBinding Background }.
2.DataTemplate is used to describe the visual style of the control's Content (data object. Use Binding to bind data object attributes, such as {Binding PersonName }. That is, ControlTemplate determines the control itself. DataTemplate determines the Content.
Generally, there is a ContentPresenter in the ControlTemplate. The ContentPresenter's ContentTemplate is of the ememplate type:
Control Type
-Template attribute (controltemplate type)
-Contentpresenter
-Contenttemplate (datatemplate type)
Contentcontrol type
-The template attribute (controltemplate type) is inherited from the control
-Contenttemplate (datatemplate type)
Itemscontrol type
-The template attribute (controltemplate type) is inherited from the control
-Itemspanel attribute (itemspaneltemplate type) specifies the layout container
-Itemtemplate attribute (datetemplate type) template of each item