Travelling on through software development
Hi Stuart, this looks great! However, I'm struggling to find MvxBaseAndroidTargetBinding - what namespace is this in, and do I need to install a specific nuget package to make use of it? Thanks! David
David, use MvxAndroidTargetBinding from MvvmCross.Binding.Droid.Target namespace.Example of usage public class MyCustomBinding: MvxAndroidTargetBinding { public MyCustomBinding(object target) : base(target) { } public override Type TargetType => typeof(TextView); protected override void SetValueImpl(object target, object value) { if(value!=null) { var c = new Color(((MvxColor) value).ARGB); ((TextView)target).SetTextColor(c); } } }
Hi Stuart, this looks great! However, I'm struggling to find MvxBaseAndroidTargetBinding - what namespace is this in, and do I need to install a specific nuget package to make use of it? Thanks! David
ReplyDeleteDavid, use MvxAndroidTargetBinding from MvvmCross.Binding.Droid.Target namespace.
DeleteExample of usage
public class MyCustomBinding: MvxAndroidTargetBinding
{
public MyCustomBinding(object target) : base(target)
{
}
public override Type TargetType => typeof(TextView);
protected override void SetValueImpl(object target, object value)
{
if(value!=null)
{
var c = new Color(((MvxColor) value).ARGB);
((TextView)target).SetTextColor(c);
}
}
}