Skip to content

Commit 82ca8cb

Browse files
authored
[.NET + WPF + HTML] Add underline support (#3316)
* Add underline support to WPF * Add underline to html
1 parent 2b9e558 commit 82ca8cb

6 files changed

Lines changed: 29 additions & 6 deletions

File tree

source/dotnet/Library/AdaptiveCards.Rendering.Html/AdaptiveCardRenderer.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class AdaptiveCardRenderer : AdaptiveCardRendererBase<HtmlTag, AdaptiveRe
1818
{
1919
protected override AdaptiveSchemaVersion GetSupportedSchemaVersion()
2020
{
21-
return new AdaptiveSchemaVersion(1, 2);
21+
return new AdaptiveSchemaVersion(1, 3);
2222
}
2323

2424
/// <summary>
@@ -1076,10 +1076,18 @@ protected static HtmlTag TextRunRender(AdaptiveTextRun textRun, AdaptiveRenderCo
10761076
uiTextRun.Style("font-style", "italic");
10771077
}
10781078

1079-
if (textRun.Strikethrough)
1079+
if (textRun.Strikethrough && textRun.Underline)
1080+
{
1081+
uiTextRun.Style("text-decoration", "line-through underline");
1082+
}
1083+
else if (textRun.Strikethrough)
10801084
{
10811085
uiTextRun.Style("text-decoration", "line-through");
10821086
}
1087+
else if (textRun.Underline)
1088+
{
1089+
uiTextRun.Style("text-decoration", "underline");
1090+
}
10831091

10841092
if (textRun.Highlight)
10851093
{

source/dotnet/Library/AdaptiveCards.Rendering.Wpf/AdaptiveCardRenderer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class AdaptiveCardRenderer : AdaptiveCardRendererBase<FrameworkElement, A
1717
{
1818
protected override AdaptiveSchemaVersion GetSupportedSchemaVersion()
1919
{
20-
return new AdaptiveSchemaVersion(1, 2);
20+
return new AdaptiveSchemaVersion(1, 3);
2121
}
2222

2323
protected Action<object, AdaptiveActionEventArgs> ActionCallback;

source/dotnet/Library/AdaptiveCards.Rendering.Wpf/AdaptiveRichTextBlockRenderer.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,12 @@ private static void AddInlineTextRun(TextBlock uiRichTB, AdaptiveTextRun textRun
7070

7171
if (textRun.Strikethrough)
7272
{
73-
textRunSpan.TextDecorations = TextDecorations.Strikethrough;
73+
textRunSpan.TextDecorations.Add(TextDecorations.Strikethrough);
74+
}
75+
76+
if (textRun.Underline)
77+
{
78+
textRunSpan.TextDecorations.Add(TextDecorations.Underline);
7479
}
7580

7681
if (textRun.Highlight)

source/dotnet/Library/AdaptiveCards/AdaptiveCard.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class AdaptiveCard : AdaptiveTypedElement
3030
/// <summary>
3131
/// The latest known schema version supported by this library
3232
/// </summary>
33-
public static AdaptiveSchemaVersion KnownSchemaVersion = new AdaptiveSchemaVersion(1, 2);
33+
public static AdaptiveSchemaVersion KnownSchemaVersion = new AdaptiveSchemaVersion(1, 3);
3434

3535
/// <summary>
3636
/// Creates an AdaptiveCard using a specific schema version

source/dotnet/Library/AdaptiveCards/AdaptiveTextRun.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,5 +125,15 @@ public AdaptiveTextRun(string text)
125125
#endif
126126
[DefaultValue(null)]
127127
public AdaptiveAction SelectAction { get; set; }
128+
129+
/// <summary>
130+
/// Make the text be underlined
131+
/// </summary>
132+
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
133+
#if !NETSTANDARD1_3
134+
[XmlAttribute]
135+
#endif
136+
[DefaultValue(false)]
137+
public bool Underline { get; set; }
128138
}
129139
}

source/dotnet/Library/AdaptiveCards/Globals.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ namespace AdaptiveCards
22
{
33
class Globals
44
{
5-
public static readonly string ObjectModelVersion = "1.2";
5+
public static readonly string ObjectModelVersion = "1.3";
66
}
77
}

0 commit comments

Comments
 (0)