[WPF]. NET Framework 4.0 improves XAML resolution-Visual can be used as the Value of Setter.

Source: Internet
Author: User

Mso-ascii-theme-font: minor-latin; mso-fareast-font-family:; mso-fareast-theme-font:
Minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin "> in WPF
Bugmso-ascii-theme-font: minor-latin; mso-fareast-font-family:; mso-fareast-theme-font:
Minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin "> List 12 Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family:; mso-fareast-theme-font:
Minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin "> we introduced a different WPFmso-ascii-theme-font: minor-latin; mso-fareast-font-family:; mso-fareast-theme-font:
Minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin "> XAMLmso-ascii-theme-font: minor-latin; mso-fareast-font-family:; mso-fareast-theme-font:
Minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin "> parse the relevant Bugmso-ascii-theme-font: minor-latin; mso-fareast-font-family:; mso-fareast-theme-font:
Minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin ">. Today we will introduce another. NET Framework 4 Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family:; mso-fareast-theme-font:
Minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin "> for XAMLmso-ascii-theme-font: minor-latin; mso-fareast-font-family:; mso-fareast-theme-font:
Minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin "> resolution improvements.

 

Mso-ascii-theme-font: minor-latin; mso-fareast-font-family:; mso-fareast-theme-font:
Minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin "> we know Buttonmso-ascii-theme-font: minor-latin; mso-fareast-font-family:; mso-fareast-theme-font:
Minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin "> belongs to ContentControlCalibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family:; mso-fareast-theme-font:
Minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin ">, ContentControlCalibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family:; mso-fareast-theme-font:
Minor-fareast; mso-hansi-font-family: Calibri; ContentCalibri in mso-hansi-theme-font: minor-latin ">; mso-ascii-theme-font: minor-latin; mso-fareast-font-family:; mso-fareast-theme-font:
Minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin "> logically, it can be any other ControlCalibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family:; mso-fareast-theme-font:
Minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin ">. So we can put Buttonmso-ascii-theme-font: minor-latin; mso-fareast-font-family:; mso-fareast-theme-font:
Minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin "> ContentCalibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family:; mso-fareast-theme-font:
Minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin "> set it to Imagemso-ascii-theme-font: minor-latin; mso-fareast-font-family:; mso-fareast-theme-font:
Minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin ">. This is also a common feature.

 

Mso-ascii-theme-font: minor-latin; mso-fareast-font-family:; mso-fareast-theme-font:
Minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin "> the code is as follows:

<Button Height = "28">
<Image Width = "16" Height = "16" Source = "Green. PNG" Stretch = "Fill"/>
</Button>

 

 

Mso-ascii-theme-font: minor-latin; mso-fareast-font-family:; mso-fareast-theme-font:
Minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin "> can we go to Buttonmso-ascii-theme-font: minor-latin; mso-fareast-font-family:; mso-fareast-theme-font:
Minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin "> Stylemso-ascii-theme-font: minor-latin; mso-fareast-font-family:; mso-fareast-theme-font:
Minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin "> put ContentCalibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family:; mso-fareast-theme-font:
Minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin "> set the attribute to Imagemso-ascii-theme-font: minor-latin; mso-fareast-font-family:; mso-fareast-theme-font:
Minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin ">? Theoretically, there should be no problems. However, the fact is that in. NET Framework 4 Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family:; mso-fareast-theme-font:
Minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin "> earlier versions of WPFmso-ascii-theme-font: minor-latin; mso-fareast-font-family:; mso-fareast-theme-font:
Minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin ">, as shown below:

Button Style With Content Stter <Style x: Key = "ImageButtonStyle" TargetType = "{x: Type Button}">
<Setter Property = "Content">
<Setter. Value>
<Image Width = "16" Height = "16" Source = "Green. PNG" Stretch = "Fill"/>
</Setter. Value>
</Setter>
<Setter Property = "ToolTip">
<Setter. Value>
<Image Width = "16" Height = "16" Source = "Green. PNG" Stretch = "Fill"/>
</Setter. Value>
</Setter>
</Style>

 

 

Mso-ascii-theme-font: minor-latin; mso-fareast-font-family:; mso-fareast-theme-font:
Minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin "> In Stylemso-ascii-theme-font: minor-latin; mso-fareast-font-family:; mso-fareast-theme-font:
Minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin "> set ContentCalibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family:; mso-fareast-theme-font:
Minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin "> or ToolTipCalibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family:; mso-fareast-theme-font:
Minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin "> or other Objectmso-ascii-theme-font: minor-latin; mso-fareast-font-family:; mso-fareast-theme-font:
Minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin "> attributes are other visual mso-ascii-theme-font: minor-latin; mso-fareast-font-family:; mso-fareast-theme-font:
Minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin ">. It can be compiled, but it will run abnormally, this Exception is thrown.

 

Unhandled Exception:
System. Windows. Markup. XamlParseException: Cannot add content of type
'System. Windows. Controls. image' to an object of type 'System. object'. Error at Object
'System. Windows. Controls. image' in markup file 'changebuttoncontent; component/mainwindow. xaml'
Line 19 Position 12.

 

Mso-ascii-theme-font: minor-latin; mso-fareast-font-family:; mso-fareast-theme-font:
Minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin "> If in Blend3mso-ascii-theme-font: minor-latin; mso-fareast-font-family:; mso-fareast-theme-font:
Minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin "> open Stylemso-ascii-theme-font above: minor-latin; mso-fareast-font-family:; mso-fareast-theme-font:
Minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin "> file. The following error is displayed:

 

"System. Windows. Controls. Image" is not a valid Value of "Setter. Value". Values Derived from Visual or ContentElement are not supported.

 

Blend3mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family:
; Mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri;
Mso-hansi-theme-font: minor-latin "> the error may seem to have a different meaning. It seems that the following line is: this should be done, but it is" not supported "now ".

 

Mso-ascii-theme-font: minor-latin; mso-fareast-font-family:; mso-fareast-theme-font:
Minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin "> the good news is :. NET Framework 4.0 Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family:; mso-fareast-theme-font:
Minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin "> Start With Stylemso-ascii-theme-font: minor-latin; mso-fareast-font-family:; mso-fareast-theme-font:
Minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin "> is completely running. Whether in VS2010mso-ascii-theme-font: minor-latin; mso-fareast-font-family:; mso-fareast-theme-font:
Minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin "> or a Blend4mso-ascii-theme-font: minor-latin; mso-fareast-font-family:; mso-fareast-theme-font:
Minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin ">.

 

Mso-ascii-theme-font: minor-latin; mso-fareast-font-family:; mso-fareast-theme-font:
Minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin "> WPFmso-ascii-theme-font: minor-latin; mso-fareast-font-family:; mso-fareast-theme-font:
Minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin "> better and better.

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.