奇怪的MultiBinding StringFormat问题

Dev*_*per 9 wpf xaml

我有这个XAML

<MultiBinding  StringFormat=" {0}{1}/{2}">
   <Binding Path="Text" ElementName="tbxAuthHost" />
   <Binding Path="Text" ElementName="tbxAuthWebsiteName" />
   <Binding Path="Text" ElementName="tbxAuthServicesAddress" />
</MultiBinding>
Run Code Online (Sandbox Code Playgroud)

当我尝试将"{0} {1}/{2}"更改为"{0} {1}/{2}",因此没有前导空格,然后Visual Studio会出现此错误:

错误3在MarkupExtension表达式的结束'}'之后,不允许使用文本"{1}/{2}".第116行位置56.

我该如何解决这个问题?

在此输入图像描述

Ray*_*Ray 16

你可以通过放在{}字符串格式的前面来解决这个问题.

StringFormat="{}{0}{1}/{2}"
Run Code Online (Sandbox Code Playgroud)

MSDN页做了解释格式的特别糟糕的工作.

如果查看转义序列上的页面,它会解释开头的开头大括号表示标记扩展(例如Binding),并且{0}{1}/{2}不是有效的标记扩展.它没有解释没有它作为第一个角色也有效.