I am creating a Cross Platform application in Xamarin MVVMCross in which I am using an Attributed Text for showing a clickable link on some part of a text.
I have created my custom class with MvxValueConverter and applied a Binding in my iOS class.
Below is my code.
public class FreeShippingConverter : MvxValueConverter<string, NSAttributedString>
{
protected override NSAttributedString Convert(string value, Type targetType, object parameter, CultureInfo culture)
{
var result = new NSMutableAttributedString(value);
var startIndex = value.IndexOf(Strings.Test, StringComparison.InvariantCultureIgnoreCase);
if (startIndex < 0)
{
return result;
}
var range = new NSRange(startIndex, Strings.Test.Length);
result.AddAttribute(UIStringAttributeKey.Font, TextStyle.B2Bold.Font(), range);
result.AddAttribute(UIStringAttributeKey.ForegroundColor, Colors.Bluescale4.ToNativeColor(), range);
return result;
}
}
Below is the Binding code from TableViewCell.
this.CreateBinding(FreeShippingText).For(v => v.AttributedText).To((FulfilmentOptionsCellViewModel vm) => vm.FreeShippingText).WithConversion<FreeShippingConverter>().Apply();
Now I want to create an Action when user clicks on "Perks Members".
How to bind that in iOS and Android?
Please help me.

Can this achieve your need?
Create a VM class:
In your MainPage.xaml:
And here is the effect.