Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.
This repository was archived by the owner on May 1, 2024. It is now read-only.

[Enhancement] FormattedText should have an implicit converter from IList<Span> #13112

@softlion

Description

@softlion

Summary

Currently to use the FormattedText property you need to add a FormattedString tag:

<Label>
<Label.FormattedText>
    <FormattedString>
         <Span Text="Some text" />
         <Span Text=": " />
     </FormattedString>
</Label.FormattedText>
</Label>

This is a lot of verbosity that can be shrinked easily by adding a TypeConverter on the FormattedText property of the Label, which would converts an IList<Span> into a FormattedString.

The simplification will leads to this more readable and much less verbose xaml:

<Label>
<Label.FormattedText>
     <Span Text="Some text" />
     <Span Text=": " />
</Label.FormattedText>
</Label>

To go further, the default Content property on the Label could be set to FormattedText leading to this xaml:

<Label>
   <Span Text="Some text" />
   <Span Text=": " />
</Label>

API Changes

none

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions