HTML Label for Xamarin.Forms
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
art
src
.gitignore
CHANGELOG.md
LICENSE
README.md

README.md

HTML Label for Xamarin.Forms apps

Build status MyGet NuGet

Easily render HTML in your Xamarin.Forms apps.

Note: This control is intended for basic text formatting (e.g., bold, italic, hyperlinks, etc.). It is not intended for rendering complex HTML or webpages - use the WebView for that.

Dependency

  • Xamarin.Forms >= 3.0.0.446417

Supported platforms

HtmlLabel is supported on the following Xamarin.Forms platforms:

  • iOS
  • Android

Usage

You use HtmlLabel just like any other control on a Xamarin.Forms ContentPage.

The value of the Text property will be rendered as HTML using the platform's native text formatting approach.

XAML example

<ContentPage 
    ...  
    xmlns:controls="clr-namespace:XamForms.HtmlLabel;assembly=XamForms.HtmlLabel">

    <StackLayout VerticalOptions="CenterAndExpand" HorizontalOptions="Center" WidthRequest="250">
        
        <Entry Text="" Placeholder="Username" />
        <Entry Text="" Placeholder="Password" />
        <Button Text="Sign in" BackgroundColor="Purple" TextColor="White" />
        
        <controls:HtmlLabel Text="Upon sign in you agree to our &lt;a href='http://www.infernored.com'&gt;Terms of Service&lt;/a&gt; and &lt;a href='http://www.infernored.com'&gt;Privacy Policy&lt;/a&gt;." />

        <!-- Or, with data binding -->
        <controls:HtmlLabel Text="{Binding SignInAgreementText}" />

    </StackLayout>

</ContentPage>

When using this control in XAML it is recommended you use XAMLC.

C# example

var signInLinks = new HtmlLabel
{
    Text = @"Upon sign in you agree to our <a href=""http://www.infernored.com"">Terms of Service</a> and <a href=""http://www.infernored.com"">Privacy Policy</a>."
};

License

Licensed under MIT. See License file