Coder Social home page Coder Social logo

htmllabel's Introduction

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

htmllabel's People

Contributors

edsnider avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

htmllabel's Issues

Click/Tap event

Hi,

Is there any way to add tap gestures?
I need a way to know it was tapped.
I was trying to use the tap from the control behind it but it is blocking all tap events...
Thanks

use css with this?

Is it possible in it's current form to have a css file linked to it?

im using this in my app because i needed more control over each of the formatting for each page but still simple enough they can all use the same xaml page, so using this to allow html formatting in each of the text blocks from my database is the only solution i could think of but without a css file i may have created a whole lot more work just so a couple pages could have an extra flair.

Hyperlinks

Can you explain how hyperlinks work from the ContentPage?

MAUI

Is there a plan to port this beauty to MAUI?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.