All Projects → matteobortolazzo → Htmllabelplugin

matteobortolazzo / Htmllabelplugin

Licence: mit
Use this Xamarin.Forms plugin to display HTML content into a label.

Projects that are alternatives of or similar to Htmllabelplugin

Mvvmcross
The .NET MVVM framework for cross-platform solutions, including Xamarin.iOS, Xamarin.Android, Windows and Mac.
Stars: ✭ 3,594 (+2920.17%)
Mutual labels:  xamarin, uwp, xamarin-forms
Smarthotel360 Mobile
SmartHotel360 Mobile
Stars: ✭ 535 (+349.58%)
Mutual labels:  xamarin, uwp, xamarin-forms
Ammyui
Ammy language repository
Stars: ✭ 356 (+199.16%)
Mutual labels:  xamarin, uwp, xamarin-forms
Reactivemvvm
Cross-platform ReactiveUI sample app built for a talk at MSK .NET conf.
Stars: ✭ 94 (-21.01%)
Mutual labels:  xamarin, uwp, xamarin-forms
Mvvmlight
The main purpose of the toolkit is to accelerate the creation and development of MVVM applications in Xamarin.Android, Xamarin.iOS, Xamarin.Forms, Windows 10 UWP, Windows Presentation Foundation (WPF), Silverlight, Windows Phone.
Stars: ✭ 973 (+717.65%)
Mutual labels:  xamarin, uwp, xamarin-forms
Arcgis Runtime Samples Dotnet
Sample code for ArcGIS Runtime SDK for .NET – UWP, WPF, Xamarin.Android, Xamarin.iOS, and Xamarin.Forms
Stars: ✭ 274 (+130.25%)
Mutual labels:  xamarin, uwp, xamarin-forms
Xamarin.forms.googlemaps
Map library for Xamarin.Forms using Google maps API
Stars: ✭ 483 (+305.88%)
Mutual labels:  xamarin, uwp, xamarin-forms
DevOpsExamples
A repo to show you how to use a private NuGet feed, such as Telerik, to restore packages in Azure DevOps, GitHub Actions, GitLab CI and AppCenter.
Stars: ✭ 16 (-86.55%)
Mutual labels:  xamarin, uwp, xamarin-forms
Rg.plugins.popup
Xamarin Forms popup plugin
Stars: ✭ 964 (+710.08%)
Mutual labels:  xamarin, uwp, xamarin-forms
Csla
A home for your business logic in any .NET application.
Stars: ✭ 865 (+626.89%)
Mutual labels:  xamarin, uwp, xamarin-forms
Xam.Plugin.AutoUpdate
Xamarin Forms plugin that auto updates your Android or UWP sideloaded application.
Stars: ✭ 22 (-81.51%)
Mutual labels:  xamarin, forms, uwp
Faceoff
An iOS, Android and UWP app created in Xamarin.Forms that uses Microsoft's Cognitive Emotion API Services to compare facial expressions
Stars: ✭ 79 (-33.61%)
Mutual labels:  xamarin, uwp, xamarin-forms
arcgis-runtime-demos-dotnet
Demo applications provided by the ArcGIS Runtime SDK for .NET Team
Stars: ✭ 51 (-57.14%)
Mutual labels:  xamarin, uwp, xamarin-forms
Open Source Xamarin Apps
📱 Collaborative List of Open Source Xamarin Apps
Stars: ✭ 318 (+167.23%)
Mutual labels:  xamarin, uwp, xamarin-forms
Toast
To use it in PCL or .NetStandard projects write this line of code : CrossToastPopUp.Current.ShowToastMessage("Message");
Stars: ✭ 51 (-57.14%)
Mutual labels:  xamarin, forms, uwp
Professionalcsharp7
Code samples for the book Professional C# 7 and .NET Core 2.0 (with updates for 2.1), Wrox Press
Stars: ✭ 403 (+238.66%)
Mutual labels:  xamarin, uwp, xamarin-forms
EBind
🔵 .NET Data Binding we deserve: concise, fast, feature-rich
Stars: ✭ 141 (+18.49%)
Mutual labels:  xamarin, uwp, xamarin-forms
XamFormsMvxTemplate
A Visual Studio 2017 template for projects based on Xamarin.Forms 3.3 and MvvmCross 6.2
Stars: ✭ 27 (-77.31%)
Mutual labels:  xamarin, uwp, xamarin-forms
Reactiveui
An advanced, composable, functional reactive model-view-viewmodel framework for all .NET platforms that is inspired by functional reactive programming. ReactiveUI allows you to abstract mutable state away from your user interfaces, express the idea around a feature in one readable place and improve the testability of your application.
Stars: ✭ 6,709 (+5537.82%)
Mutual labels:  xamarin, uwp, xamarin-forms
Xamarin.plugins
Cross-platform Native API Access from Shared Code!
Stars: ✭ 1,176 (+888.24%)
Mutual labels:  xamarin, uwp, xamarin-forms

Build Status Downloads

HTML Label Plugin for Xamarin.Forms

Use this Xamarin.Forms plugin to display HTML content into a label.

Setup

  • Available on NuGet
  • Install it in every Xamarin.Forms project.
  • iOS: AppDelegate.cs
    HtmlLabelRenderer.Initialize();
    global::Xamarin.Forms.Forms.Init();
    
  • Android: MainActivity.cs
    HtmlLabelRenderer.Initialize();
    global::Xamarin.Forms.Forms.Init(this, bundle);
    
  • UWP: App.xaml.cs
    var rendererAssemblies = new[] { typeof(HtmlLabelRenderer).GetTypeInfo().Assembly };
    Xamarin.Forms.Forms.Init(e, rendererAssemblies);
    HtmlLabelRenderer.Initialize();
    

How it works

On iOS and Android it uses the native HTML rendering capabilities of iOS's UILabel and Android's TextView.

UWP's TextBlock cannot renders HTML so the library parses the HTML and uses Inlines to display: <a>, <b>, <br>, <em>, <i>, <p>, <strong>, <u>, <ul> <li>, <div>.

FontAttributes, FontFamily, FontSize, TextColor, HorizontalTextAlignment are converted into inline CSS in a wrapping <div> for iOS and Android. UWP supports them natively.

Custom styling

If you need to customize something in Android or iOS you can use inline CSS, for example:

<span style="color: green">...</span>

For underlined text use the <u> tag: <u>Some underlined text</u>

For links: remember to add the schema (http:// https:// tel:// mailto:// ext...)

WARNING: not all styles are supported by each platform!

Supported Properties

  • Text
  • FontAttributes
  • FontFamily
  • FontSize
  • TextColor
  • HorizontalTextAlignment
  • LineHeight (iOS, UWP)
  • UnderlineText
  • LinkColor
  • BrowserLaunchOptions
  • AndroidLegacyMode

Events

Navigating Navigated

Usage XAML

xmlns:htmlLabel="clr-namespace:LabelHtml.Forms.Plugin.Abstractions;assembly=HtmlLabel.Forms.Plugin"
<htmlLabel:HtmlLabel Text="{Binding HtmlString}"/>

Usage C#

var label = new HtmlLabel();
label.Text = "..htmlstring.."

Links

It is possible to customize links:

  • Color
  • Underline
  • Browser options

Browser options are applied with the following schemas: http, https, mailto, tel, sms and geo.

WARNING: This project uses Xamarin.Essentials to provide native Email, Phone Dial, SMS and Maps support. Please check the getting started page.

iOS WARNING: Changing the style of iOS links is not supported by iOS intentionally and this plugin use a workaround. From Apple:

To promote consistency, the intended behavior is for ranges that represent links (specified via NSLinkAttributeName) to be drawn using the default link appearance.

UWP WARNING: The minimum target for UWP is 17763. If set to an older version, it won't find the assembly.

Android's Legacy Mode

Settings the property AndroidLegacyMode to True the renderer separates block-level elements with blank lines.

Limitations

  • XF Label's TextType="HTML" disables this implementation.
  • Adding GestureRecognizers will disabled links.
  • List of Android's supported tags here.

Contributions

Contributions are welcome!

License

Under MIT, see LICENSE file.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].