WPF Button content with '&' not accepting

前端 未结 4 1848
伪装坚强ぢ
伪装坚强ぢ 2020-12-10 10:38

I am creating and with content \'Save & Add\'. I write it in XAML, but the symbol \'&\' is not accepting. What is the reason for that. How can I do that?

相关标签:
4条回答
  • 2020-12-10 11:06

    From Wikipedia:

    Unlike traditional HTML with its large range of character entity references, in XML there are only five predefined character entity references. These are used to escape characters that are markup sensitive in certain contexts:

    • & → & (ampersand, U+0026)
    • &lt; → < (less-than sign, U+003C)
    • &gt; → > (greater-than sign, U+003E)
    • &quot; → " (quotation mark, U+0022)
    • &apos; → ' (apostrophe, U+0027)
    0 讨论(0)
  • 2020-12-10 11:06

    You might need to escape it as "&amp;". See this link.

    0 讨论(0)
  • 2020-12-10 11:07

    Markup files that are created in Microsoft Visual Studio are automatically saved in the Unicode UTF-8 file format, which means that most special characters, such as accent marks, are encoded correctly

    https://msdn.microsoft.com/en-us/library/aa970677(v=vs.100).aspx

    0 讨论(0)
  • 2020-12-10 11:12

    Use &amp; instead of &.

    You might find this article of some use - How to: Use Special Characters in XAML

    0 讨论(0)
提交回复
热议问题