protected override void Write([NotNull] Markdig.Renderers.WpfRenderer renderer, [NotNull] TaskList taskList) { var checkBox = new CheckBox { IsChecked = taskList.Checked, Tag = _checkCount, Command = TaskListItemChanged }; checkBox.CommandParameter = checkBox; _checkCount++; checkBox.SetResourceReference(FrameworkContentElement.StyleProperty, Styles.TaskListStyleKey); renderer.WriteInline(new InlineUIContainer(checkBox)); }
/// <inheritdoc/> protected override void Write([NotNull] Markdig.Renderers.WpfRenderer renderer, [NotNull] LinkInline link) { var url = link.GetDynamicUrl != null?link.GetDynamicUrl() ?? link.Url : link.Url; if (!Uri.IsWellFormedUriString(url, UriKind.RelativeOrAbsolute)) { url = "#"; } if (link.IsImage) { var image = new Image { Source = new BitmapImage(new Uri(url, UriKind.RelativeOrAbsolute)) }; image.SetResourceReference(FrameworkContentElement.StyleProperty, Styles.ImageStyleKey); renderer.WriteInline(new InlineUIContainer(image)); } else { var hyperlink = new Hyperlink { Command = Markdig.Wpf.Commands.Hyperlink, CommandParameter = url, NavigateUri = new Uri(url, UriKind.RelativeOrAbsolute), ToolTip = link.Title != string.Empty ? link.Title : null, }; hyperlink.SetResourceReference(FrameworkContentElement.StyleProperty, Styles.HyperlinkStyleKey); renderer.Push(hyperlink); renderer.WriteChildren(link); renderer.Pop(); } }