xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.64k stars 1.88k forks source link

xamarin forms ios label textdecorations don't work when using formattedtext #15749

Open vsfeedback opened 1 year ago

vsfeedback commented 1 year ago

This issue has been moved from a ticket on Developer Community.


I want to dynamically update the text of a label so that parts of the label are underlined. (highlighting what section of the text the narrator is reading).

On Xamarin.UWP and Xamarin.Android this works as expected. On iOS it does not.

problem 1: text is not underlined as expected problem 2: middle text span receives different fontsize while this property is set on the label problem 3: textdecorations and fontattributes declared in xaml are not adhered problem 4: bold sections is not bold, only the section that is bold AND underlined is bold

On this page a user stated a regression in behaviour is introduced by moving from 16.0 to 16.2. I have not tested if downgrading fixes the problem. https://stackoverflow.com/questions/72121135/span-label-underline-is-not-working-on-xamarin-ios/75878433#75878433

The following sample code that illustrates multiple problems with textdecorations:

View: <?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="BB.App.ViewModels.TestView"