简体   繁体   中英

Using backslashes XAML Attribute MultiBinding.ConverterParameter of type string results in escaped backslash

I'm using a string as a MultiBinding.ConverterParameter in a XAML-definition of a WPF-Window. The converter concatenates multiple strings and uses the ConverterParameter as separator between them. My problem is: when I want to use a CRLF as separator, the XAML-parser somehow escapes my backslashes. So i get "\\r\\n" as parameter in the converter. I tried the following variants:

<MultiBinding Converter="{StaticResource mergeStringsMultiValueConverter}" >
    <MultiBinding.ConverterParameter>
        \r\n
    </MultiBinding.ConverterParameter>
    <Binding Path="ApprovalJoystick.ExtendedDisplayString" Mode="OneWay"/>
    <Binding Path="ApprovalJoystickActiveText" Mode="OneWay" />
</MultiBinding>

and

<MultiBinding Converter="{StaticResource mergeStringsMultiValueConverter}" ConverterParameter="\r\n">
    <Binding Path="ApprovalJoystick.ExtendedDisplayString" Mode="OneWay" />
    <Binding Path="ApprovalJoystickActiveText" Mode="OneWay" />
</MultiBinding>

Result is the same. Is the a way to get the CRLF as I wrote it in XAML (without escaping)? Or can I write the linebreak in another way in XAML?

Thank you.

Try &#10; , &#13; or &#x0d;&#x0a; . See Newline in string attribute .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM