"Programming WPF" translation 5th 2. Inline styles

Source: Internet
Author: User

Original: "Programming WPF" translation 5th Chapter 2. Inline styles

Each "can be styled" WPF elements have a Style property that can be set internally-using the XAML attribute - element syntax (discussed in the first chapter), such as example 5-4.

Example 5-4

<Buttonx:name= "Cell00" />
<Button.style>

<Style>
<Setter Property= "Button.fontsize"Value= "+" />
<Setter Property= "Button.fontweight"Value= "Bold" />
</Style>
</Button.style>
</Button>


Because we want to bundle the property values in our style, we have a STYLE element with two setter child elements , one for each property we want to set, such as FontSize and fontweight , all with a Button prefix that indicates the class that contains the property. The properties that apply to the style are dependency properties, which are described in chapter Nineth.

Because of the extra style syntax and because inline styles cannot be shared across elements, inline styles are in fact more input when setting properties. For this reason, inline styles are often used without naming styles.

"Programming WPF" translation 5th 2. Inline styles

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.