Xamarin表格显示IValueConverter编译时出现错误

问题描述 投票:0回答:1

我想在xamarin表单中为Rg插件弹出窗口创建值转换器,它应该显示Yes或No(True / False),但是当我编译时显示:

位置14:14。在xmlns clr-namespace中找不到类型cnv:BoolToStringConverter:RodoAcceptance.Converters; assembly = RodoAcceptance RodoAcceptance

这是XAML视图和值转换器

enter image description here

后面的代码:

enter image description here

enter image description here

c# xamarin.forms ivalueconverter
1个回答
0
投票

如果您的转换器具有TypeArgument <T>,则应按以下方式使用它:

<Label>
    <Label.Text>
        <Binding Source="{x:Reference switch1}"
                     Path="IsToggled">
            <Binding.Converter>
                <local:BoolToObjectConverter x:TypeArguments="x:String"
                                                 TrueObject="Of course!"
                                                 FalseObject="No way!" />
            </Binding.Converter>
        </Binding>
    </Label.Text>
</Label>
© www.soinside.com 2019 - 2024. All rights reserved.