Skip to content

Instantly share code, notes, and snippets.

@kevingosse
Created January 9, 2018 15:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kevingosse/5d28d8954fb58f0ed0d9129863c604fd to your computer and use it in GitHub Desktop.
Save kevingosse/5d28d8954fb58f0ed0d9129863c604fd to your computer and use it in GitHub Desktop.
int index = 0;
foreach (Match match in matches)
{
paragraph.Inlines.Add(new Run(System.Net.WebUtility.HtmlDecode(content.Substring(index, match.Index - index))));
var hyperLink = new Hyperlink(new Run(match.Groups["label"].Value));
var command = match.Groups["command"].Value;
hyperLink.Command = new DmlCommand(() => _ = ExecuteCommand(command));
paragraph.Inlines.Add(hyperLink);
index = match.Index + match.Length;
}
if (index < content.Length)
{
paragraph.Inlines.Add(new Run(System.Net.WebUtility.HtmlDecode(content.Substring(index))));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment