WPF Notes (1.3 attribute elements)--hello,wpf!

Source: Internet
Author: User

Original: WPF notes (1.3 attribute elements)--hello,wpf!

The concept of "attribute elements" in this section can be described as unthinkable.
1. WPF implements object modeling with tag elements in two ways: control and container, which are used to load content and behavior, such as button, which is like window.
You can write this:

<Window>
<Button Width=" -"Height=" -">
<Image Source="Tom.png" />
</Button>
</Window>You can also do this:
<Window>
<Button Width=" -"Height=" -">
<TextBox Width=" the">Edit Me</TextBox>
</Button>
</Window>This means that the image property of the original button and the TextBox property are extracted as objects. This is because the button originates from a class: ContentControl, which knows how to build all the controls it loads.

2. In fact, the complete wording is this:
<Button Width=" -"Height=" -">
<button.content>
<Image Source="Tom.png" />
</button.content>
</Button>However, the,<button.content> tag cannot have two controls, it will display syntax errors and can only be an attribute element--this time using a panel.
The window control has the same usage as the button, as shown in the following section.

WPF Notes (1.3 attribute elements)--hello,wpf!

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.