Method wpfBuilder.formattedText
Overload
Creates new System.Windows.Controls.TextBlock and adds inlines like wpfBuilder.FormatText.
public static TextBlock formattedText(wpfBuilder.InterpolatedString text)
Parameters
text (wpfBuilder.InterpolatedString)
Interpolated string (like These tags add inlines of these types:
Tags can have these attributes, like
WPF elements of these types can be inserted without tags:
XML special characters must be escaped:
The |
Returns
Exceptions
ArgumentException
Unknown |
InvalidOperationException
The same |
FormatException
Invalid color attribute. |
Exception
Exceptions of System.Xml.Linq.XElement.Parse. |
Examples
b.R.Add(wpfBuilder.formattedText($"<b>Label</b>"), out TextBox _);
b.R.AddButton(_TextWithIcon("Button", "*PixelartIcons.Notes #0060F0"), _ => { print.it("Button clicked"); });
static TextBlock _TextWithIcon(string text, string icon) {
var e = ImageUtil.LoadWpfImageElement(icon);
e.Margin = new(0, 0, 4, 0);
return wpfBuilder.formattedText($"{e}{text}");
}