如何在ComboBoxItem的内容中包含&符号(&) [英] How to include an ampersand (&) in the content of a ComboBoxItem

查看:338
本文介绍了如何在ComboBoxItem的内容中包含&符号(&)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前有一个如下的组合框:

I currently have a Combobox like the following:

//XAML
<ComboBox>
<ComboBoxItem> Awake & Alive</ComboBoxItem>
</ComboBox>

这引发了一个错误:
实体引用或以&符号开头的序列'&'必须用分号';'终止。

This raises an error: Entity references or sequences beginning with an ampersand '&' must be terminated with a semicolon ';'.

我假设我错过了某种转义序列,以允许我使用& amp;如何设置此组合框的内容以包括&
谢谢

I assume I am missing an escape sequence of some sort to allow me to use a &. How can I set the content of this comboboxitem to include a &? Thanks

推荐答案

使用& amp; amp; &符号。

//XAML
<ComboBox>
<ComboBoxItem> Awake &amp; Alive</ComboBoxItem>
</ComboBox>

这篇关于如何在ComboBoxItem的内容中包含&符号(&amp;)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆