public void SetFormattedText(FormattedText text) { label.Text = text?.Text; formattedText = text; label.Realized -= HandleStyleUpdate; label.StyleSet -= HandleStyleUpdate; label.ApplyFormattedText(text); label.Realized += HandleStyleUpdate; label.StyleSet += HandleStyleUpdate; }
public void SetFormattedText(FormattedText text) { // set content with a custom label, this will recreate labelWidget SetContent(text?.Text, Widget.UseUnderline, image, contentPosition, true); formattedText = text; if (!string.IsNullOrEmpty(formattedText?.Text)) { if (labelWidget.IsRealized) { labelWidget.ApplyFormattedText(formattedText); } else { labelWidget.Realized += HandleStyleUpdate; } labelWidget.StyleSet += HandleStyleUpdate; } }