mca*_*ara 2 xaml xamarin xamarin.forms
我如何在ConverterParameter中发送静态值,如数字?
<Label Style="{DynamicResource ListItemDetailTextStyle}" Text="{Binding Information, Converter={StaticResource CutStringConverter}, ConverterParameter={100}}" />
Run Code Online (Sandbox Code Playgroud)
您可能需要包含该类型.所以要么像这样内联:ConverterParameter={x:Int32 100}.
或者写得更冗长:
<Label>
<Label.Text>
<Binding Path="Information" Converter="{StaticResource CutStringConverter}">
<Binding.ConverterParameter>
<x:Int32>100</x:Int32>
</Binding.ConverterParameter>
</Binding>
</Label.Text>
</Label>
Run Code Online (Sandbox Code Playgroud)
或者,要完成,请向页面添加静态资源(或任何容器),例如:
<ContentPage.Resources>
<x:Int32 x:Key="IntHundred">100</x:Int32>
</ContentPage.Resources>
Run Code Online (Sandbox Code Playgroud)
并参考: ConverterParameter={StaticResource IntHundred}
| 归档时间: |
|
| 查看次数: |
1581 次 |
| 最近记录: |