WPF control templates and data templates-tipsy rooms

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.