Xamarin.forms 更改listview中的绑定值

Xamarin.forms 更改listview中的绑定值,xamarin.forms,Xamarin.forms,在我的列表视图中有一个控件是标签,它绑定到布尔值从视图模型提交,在这种情况下布尔值是布尔类型,因此值可以是真或假。有没有办法用其他文本替换它?我使用MVVM <Label Text="{Binding BoolValue}" /> <Label 是的,使用 然后在您的XAML中 <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"

在我的
列表视图中
有一个控件是
标签
,它绑定到
布尔值
视图模型
提交,在这种情况下
布尔值
是布尔类型,因此值可以是
。有没有办法用其他文本替换它?我使用MVVM

  <Label
       Text="{Binding BoolValue}" />
  <Label

是的,使用

然后在您的XAML中

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
         xmlns:local="clr-namespace:MyDemo"
         x:Class="MyDemo.MyPage"
         >
    <ContentPage.Resources>
        <ResourceDictionary>
            <local:BoolToStringConverter x:Key="BoolToString" />
        </ResourceDictionary>
    </ContentPage.Resources>

    ...

    <Label Text={Binding BoolValue, Converter={StaticResource BoolToString}}" />

    ...
  

...

我看到的是这个转换器BoolToStringConverter只能转换成两个值真值或假值。如果另一个标签想要有另一个值来对抗false/true,该怎么办。根据不同的控制,是否可以说转换器需要不同的值?例如,在这一行:
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
         xmlns:local="clr-namespace:MyDemo"
         x:Class="MyDemo.MyPage"
         >
    <ContentPage.Resources>
        <ResourceDictionary>
            <local:BoolToStringConverter x:Key="BoolToString" />
        </ResourceDictionary>
    </ContentPage.Resources>

    ...

    <Label Text={Binding BoolValue, Converter={StaticResource BoolToString}}" />

    ...