我正試圖綁定Android中TextView的文本顏色。這裏是我的(截)XAML:如何綁定TextView的TextColor?
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:MvxBind=" TextColor CategoryTextColor(Category)"/>
其中CategoryTextColorValueConverter如下:
public class CategoryTextColorConverter : MvxValueConverter<ShowCategory, Color>
{
protected override Color Convert (ShowCategory value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value == ShowCategory.AllShows)
{
return Color.Blue;
}
return Color.Red;
}
}
轉換器獲取調用和按預期返回一個顏色,但文本顏色從不TextView的變化。我有一個類似的工作正常的背景顏色綁定。我在這裏看到In MvvmCross how do I do custom bind properties,也許我需要創建一個自定義綁定,但我找不到MvxBaseAndroidTargetBinding
。也許我需要從nuget安裝一個單獨的包?
我正在使用這個,文本本身現在不可見。我在轉換方法中保留了一個斷點,它不會在那裏出現。 – GvSharma