我与转换器有绑定(bind)关系。我想将“#,,.0M”格式字符串作为转换器参数传递。
此 xaml 无效:
<local:SalesPerformanceControl FirstSalesVolume="{Binding Path=TodaySalesVolume, Converter={StaticResource ResourceKey=decimalToFormatedStringConverter}, ConverterParameter=#,,.0M}"/>
错误:
The type '' was not found.
如何正确传递这个字符串?
要么在要传递的字符串上使用单引号:
<local:SalesPerformanceControl FirstSalesVolume="{Binding Path=TodaySalesVolume, Converter={StaticResource ResourceKey=decimalToFormatedStringConverter}, ConverterParameter='#,,.0M'}"/>
或者使用详细的语法来绑定(bind),如下所示:
<local:SalesPerformanceControl>
<local:SalesPerformanceControl.FirstSalesVolume>
<Binding Path="TodaySalesVolume" Converter="{StaticResource decimalToFormatedStringConverter}" ConverterParameter="#,,.0M" />
</local:SalesPerformanceControl.FirstSalesVolume>
</local:SalesPerformanceControl>
我是一名优秀的程序员,十分优秀!