I have this XAML
<MultiBinding StringFormat=" {0}{1}/{2}">
<Binding Path="Text" ElementName="tbxAuthHost" />
<Binding Path="Text" ElementName="tbxAuthWebsiteName" />
<Binding Path="Text" ElementName="tbxAuthServicesAddress" />
</MultiBinding>
When I try change " {0}{1}/{2}" into "{0}{1}/{2}" so no leading space there and then Visual Studio gives this error:
Error 3 The text '{1}/{2}' is not allowed after the closing '}' of a MarkupExtension expression. Line 116 Position 56.
How I can fix this issue?
You can fix this by putting {}
at the front of the string format.
StringFormat="{}{0}{1}/{2}"
The MSDN Page does a particularly bad job of explaining the format.
If you look at the page on the escape sequence it explains that an opening curly bracket at the beginning denotes a markup extension (e.g. Binding), and {0}{1}/{2}
is not a valid markup extension. It doesn't explain that not having it as the first character also works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With