Starting from 0 WPF MVVM Enterprise-level framework implementation and description----third speaking WPF DataTemplate

Source: Internet
Author: User

Later in our project will be a large number of templates, mainly refers to the space template, the data template will be used relatively little, below I want to introduce the control template and data template, I see a great god written relatively good, I tidied up, so that we can better understand, for everyone to reference,

First introduce DataTemplate

DataTemplate: Is the performance of the data content, a piece of data shows what it looks like

1. The data template is commonly used in the following places:

    • The ContentTemplate property of the ContentControl.
    • The ItemTemplate property of the ItemsControl.
    • The CellTemplate property of the Gridviewcolumn.

2. Example

ContentControl

ItemsControl

ItemsControl has a paneltemplate that can control ItemsControl's entry container.

DataTemplate can also function on a data type, except that it can be used on a control

We will have a module in the back of this place will be used, and now I simply say:

For example, you want to make a datatemplate, through this designation ControlTemplate, then you can follow this way, the specific later project will have a case

<datatemplate datatype= "{x:type your ViewModel type}" >
<contentcontrol template= "{StaticResource you define ControlTemplate}"/>
</DataTemplate>

Starting from 0 WPF MVVM Enterprise-level framework implementation and description----third speaking WPF DataTemplate

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.