From 97d2f30f6bf6d3875394ab34478cd8fded7574a6 Mon Sep 17 00:00:00 2001 From: Alan Grgic Date: Fri, 20 Jul 2018 18:57:11 -0500 Subject: [PATCH] [Enhancement] Allow underline and strikethrough text decorations on labels and spans (#2221) * Fixes #1632 * Allow underline and strikethrought text decorations on labels and spans * revert some files * pr feedback adjustments * remove docs * rename interface * reorder enum * clean up whitespace * adjust tizen renderer * add gallery demo for setting both underline and strike * allow multiple values of enum to be set in xaml/css * use normal null check * use nameof * include paragraph style * tab alignment * rebase from upstream * pass control to update method on UWP * correct text decorations type converter * reset run text instead of label text on UWP when spans are used * add tests for text decoration converter --- .../CoreGalleryPages/LabelCoreGalleryPage.cs | 10 ++++ .../GalleryPages/LabelGallery.cs | 18 ++++++- .../TextDecorationUnitTests.cs | 28 +++++++++++ .../Xamarin.Forms.Core.UnitTests.csproj | 5 +- Xamarin.Forms.Core/DecorableTextElement.cs | 49 +++++++++++++++++++ Xamarin.Forms.Core/IDecorableTextElement.cs | 11 +++++ Xamarin.Forms.Core/Label.cs | 10 +++- Xamarin.Forms.Core/Properties/AssemblyInfo.cs | 1 + Xamarin.Forms.Core/Span.cs | 10 +++- .../TestAttributes.cs | 2 + .../FastRenderers/LabelRenderer.cs | 18 +++++++ .../Renderers/FormattedStringExtensions.cs | 31 +++++++++++- .../Renderers/LabelRenderer.cs | 22 ++++++++- .../Renderers/LabelRenderer.cs | 14 ++++++ Xamarin.Forms.Platform.UAP/LabelRenderer.cs | 39 +++++++++++++++ .../Extensions/FormattedStringExtensions.cs | 10 ++++ .../Renderers/LabelRenderer.cs | 26 ++++++++++ .../Renderers/FormattedStringExtensions.cs | 36 ++++++++++---- .../Renderers/LabelRenderer.cs | 39 +++++++++++++++ 19 files changed, 361 insertions(+), 18 deletions(-) create mode 100644 Xamarin.Forms.Core.UnitTests/TextDecorationUnitTests.cs create mode 100644 Xamarin.Forms.Core/DecorableTextElement.cs create mode 100644 Xamarin.Forms.Core/IDecorableTextElement.cs diff --git a/Xamarin.Forms.Controls/CoreGalleryPages/LabelCoreGalleryPage.cs b/Xamarin.Forms.Controls/CoreGalleryPages/LabelCoreGalleryPage.cs index 393fdd513..9f5789689 100644 --- a/Xamarin.Forms.Controls/CoreGalleryPages/LabelCoreGalleryPage.cs +++ b/Xamarin.Forms.Controls/CoreGalleryPages/LabelCoreGalleryPage.cs @@ -26,6 +26,14 @@ namespace Xamarin.Forms.Controls var namedSizeMediumItalicContainer = new ViewContainer