Introduction to three WPF templates and three wpf templates
WPF supports the following types of templates:
(1) control template. A control template can apply a custom template to all controls of a specific type or an instance of a control. The ControlTemplate determines the control's appearance. It determines what the control looks like. Therefore, the control template is represented by the ControlTemplate class. The control template is actually defined in the resource set or resource dictionary. For example, see: Design ControlTemplate to create a rounded corner text box and a rounded corner button (http://www.cnblogs.com/zhouhb/p/3284780.html ).
(2) Data Template. In WPF, DataTemplate determines the data appearance, that is, DataTemplate represents the data content. What is a piece of data displayed? Is it a simple text or intuitive image, it is determined by DataTemplate. See DataTemplate application (http://www.cnblogs.com/zhouhb/p/3284827.html) for details ).
(3) ItemsPanelTemplate. ItemsPanelTemplate specifies the Panel used for the layout of items. The following example sets the ItemsPanelTemplate of ListBox to display each item in sequence from left to right.
WrapPanel positions the child element from left to right in sequence and disconnects the content from the edge of the contained box to the next line. The subsequent sorting is performed from top to bottom or from right to left, depending on the value of the Orientation attribute (the default value is Horizontal ).
<ListBox AllowDrop = "True" Margin = "0, 1, 262,0">
<ListBox. ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel/>
</ItemsPanelTemplate>
</ListBox. ItemsPanel>
<Label Name = "label1" Content = "E"/>
<Label Name = "label2" Content = "A"/>
<Label Name = "label3" Content = "I"/>
<Label Name = "label4" Content = "M"/>
</ListBox>
Running effect:
Three templates for WPF learning, you can further reference: WPF detailed templates (http://www.cnblogs.com/dingli/archive/2011/07/20/2112150.html ).