José Guilherme
José Guilherme

Reputation: 107

How can I cut the end of the text of a label with HTML format

I verified in some tests that just using TextType as Text, I can cut the text from a label at the end.

I wonder if there is any way to accomplish this in text in HTML format.

<Label Text="{Binding message}"
       TextType="Html"
       LineBreakMode="TailTruncation"
       HorizontalOptions="StartAndExpand"
       Style="{StaticResource LabelStyle}"/>

Upvotes: 0

Views: 89

Answers (1)

Wendy Zang - MSFT
Wendy Zang - MSFT

Reputation: 10938

You could binding the text with html string like below.

 public string message { get; set; }
    public MainPage()
    {
        InitializeComponent();
        message = "This is <strong>HTML</strong> text.";

        this.BindingContext = this;
    }

enter image description here

Upvotes: 1

Related Questions