A while back I talked about building your own Markdown Label / TextView to your Xamarin applications including Xamarin Native and Xamarin Forms. I decided to put the control I’ve been working off of over on NuGet so anyone can use its basic form.
Note that this control isn’t final, I am working on some refactoring and enhancements, but if you want something that just works, then give it a shot, or contribute to the repository!
- NuGet: https://www.nuget.org/packages/MarkdownTextView.Forms
- GitHub: https://github.com/SuavePirate/MarkdownTextView
Previous Posts
- Xamarin.Controls – Creating your own Markdown TextBlock in UWP
- Xamarin.Controls – Creating Your Own iOS Markdown UILabel
- Xamarin.Controls – Creating Your Own Android Markdown TextView
- Xamarin.Controls – MarkdownTextView
Down below you can find the documentation as it’s found on the GitHub repo!
MarkdownTextView
A Xamarin.Forms component to display markdown text in a TextView
Installation
Now on NuGet!
Install-Package MarkdownTextView.Forms
https://www.nuget.org/packages/MarkdownTextView.Forms
Usage
- Call
Init
before callingXamarin.Forms.Init()
- iOS: SPControls.MarkdownTextView.iOS.MarkdownTextView.Init();
- Android: SPControls.MarkdownTextView.Droid.MarkdownTextView.Init();
- Use the control
- In Xaml:
<ContentPage ... xmlns:spcontrols="clr-namespace:SPControls.Forms;assembly=SPControls.MarkdownTextView" ...> <spcontrols:MarkdownTextView Markdown="{Binding MarkdownString}" /> </ContentPage>
- or in C#:
var mdTextView = new MarkdownTextView(); mdTextView.Markdown = "# this is my *header* tag";
TODO
- Add other properties for updating markdown settings
- Add text color settings
- Add UWP Support