如何在XAML中将FormatString作为ConverterParameter传递

Eug*_*mov 1 c# wpf xaml

我有转换器绑定.我想将"#,,.0M"格式字符串作为转换器参数传递.

此xaml无效:

<local:SalesPerformanceControl FirstSalesVolume="{Binding Path=TodaySalesVolume, Converter={StaticResource ResourceKey=decimalToFormatedStringConverter}, ConverterParameter=#,,.0M}"/>
Run Code Online (Sandbox Code Playgroud)

错误:

找不到类型''.

如何正确传递此字符串?

Nit*_*tin 6

要在要传递的字符串上使用单引号:

       <local:SalesPerformanceControl FirstSalesVolume="{Binding Path=TodaySalesVolume, Converter={StaticResource ResourceKey=decimalToFormatedStringConverter}, ConverterParameter='#,,.0M'}"/>
Run Code Online (Sandbox Code Playgroud)

或使用精心设计的语法绑定如下:

    <local:SalesPerformanceControl>
        <local:SalesPerformanceControl.FirstSalesVolume>
            <Binding Path="TodaySalesVolume" Converter="{StaticResource decimalToFormatedStringConverter}" ConverterParameter="#,,.0M" />
        </local:SalesPerformanceControl.FirstSalesVolume>
    </local:SalesPerformanceControl>
Run Code Online (Sandbox Code Playgroud)