How to put different text formatting and hyperlink in a text property

Viewed 169

I want to use a syncfusion check box in my xamarin.forms project and the text property should contain a hyperlink on a single word block which should be underlined like this:

[ ] By continuing to register an account you agree the "terms and conditions"

The word block "terms and conditions" should be underlined with a hyperlink.

The XAML of the check box looks like this:

<SfCheckBox x:Name="checkBoxIsAgreed" Text="text here"/>

How can I achieve this with only a text property which is a string?

Thanks in advance!

1 Answers

Better you can separate the text and Checkbox like below.

    <StackLayout Orientation="Vertical">
        <SfCheckBox Text="text here"/>
        <Label>
            <Label.FormattedText>
                <FormattedString>
                    <Span Text="Text Here" />
                    <Span Text="Terms and Conditions" TextDecorations="Underline">
                        <Span.GestureRecognizers>
                            <TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped"/>
                        </Span.GestureRecognizers>
                    </Span>
                </FormattedString>
            </Label.FormattedText>
        </Label>
    </StackLayout>
Related