How to use a literal curly brace “{” in XAML?

。_饼干妹妹 提交于 2020-01-03 06:45:09

问题


I need put in } and { in a XAML ConvertParameter without it being interpreted:

ConverterParameter = "{0}/{1}"

...which does not work. How to do this?


回答1:


You can use:

ConverterParameter = "{}{0}/{1}"

More information can be found here.




回答2:


Use {} as the escape sequence.

ConverterParameter = "{}{0}/{1}"



回答3:


For those who got here looking for the answer for WinRT-XAML. The escape sequence is \ sign. Although this documentation states ' should work but on the other hand this example uses \ (which actually worked for me).



来源:https://stackoverflow.com/questions/6312371/how-to-use-a-literal-curly-brace-in-xaml

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!