A bit late but I had the same requirement and just did it now.
Add the following in your setup file (I have two custom bind properties, Style and Summary):
protected override void FillTargetFactories(IMvxTargetBindingFactoryRegistry registry)
{
base.FillTargetFactories(registry);
registry.RegisterFactory(new MvxCustomBindingFactory<TextView>("Style", textView => new StyleTextViewBinding(textView)));
registry.RegisterFactory(new MvxCustomBindingFactory<TextView>("Summary", textView => new SummaryTextViewBinding(textView)));
}
In my TextView (my custom binding is Style obviously, Text and TextColor are converters):
<TextView
style="@style/TeamDifficulty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="@string/dummy_title"
local:MvxBind="Text TeamDifficultyText(RowItem.DifficultyEnumCaptain1Int); TextColor TeamDifficultyTextColor(RowItem.DifficultyEnumCaptain1); Style RowItem.DifficultyEnumCaptain1;" />
And the actual code (basically it checks if my text is empty or not, if it is, it will bold it since my converter will add a value to it after):
public class StyleTextViewBinding : MvxAndroidTargetBinding
{
readonly TextView _textView;
public StyleTextViewBinding(TextView textView) : base(textView)
{
_textView = textView;
}
#region implemented abstract members of MvxConvertingTargetBinding
protected override void SetValueImpl(object target, object value)
{
_textView.SetTypeface(_textView.Typeface, Android.Graphics.TypefaceStyle.Bold);
if (value != null && Convert.ToBoolean(value))
_textView.SetTypeface(_textView.Typeface, Android.Graphics.TypefaceStyle.Normal);
}
#endregion
public override Type TargetType
{
get { return typeof(bool); }
}
public override MvxBindingMode DefaultMode
{
get { return MvxBindingMode.OneWay; }
}
}
Hope this helps!