Skip to content

Commit

Permalink
Enable Text property to act as Content
Browse files Browse the repository at this point in the history
This is useful to easily use html snippets in xaml:

```xaml
    <htm:HtmlLabel>
      <![CDATA[
        <p><b>Hello <u>World</u></b></p>
        <p><i>This is a Sample Paragraph</i> in html coming from CDATA section</p>
      ]]>
    </htm:HtmlLabel>
```
  • Loading branch information
fitdev authored Feb 5, 2024
1 parent 519f70e commit 853e2d0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Source/Avalonia.HtmlRenderer/HtmlControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
using Avalonia.Interactivity;
using Avalonia.Media;
using Avalonia.Media.Immutable;
using Avalonia.Metadata;
using Avalonia.Threading;
using TheArtOfDev.HtmlRenderer.Core;
using TheArtOfDev.HtmlRenderer.Core.Entities;
Expand Down Expand Up @@ -273,6 +274,7 @@ public string BaseStylesheet
/// Gets or sets the text of this panel
/// </summary>
[Description("Sets the html of this control.")]
[Content]
public string Text
{
get { return (string)GetValue(TextProperty); }
Expand Down Expand Up @@ -575,4 +577,4 @@ private void OnRefresh(object sender, HtmlRefreshEventArgs e)

#endregion
}
}
}

0 comments on commit 853e2d0

Please sign in to comment.