public static FlowDocument AddDrop(this StackPanel sp, Drop drop) { FlowDocumentParser fdp = new FlowDocumentParser() { TextAlignment = TextAlignment.Right }; fdp.AddBold(drop.Author.Name + " at " + String.Format("{0:dd/MM/yyyy HH:mm}", drop.UpdatedAt)); fdp = new FlowDocumentParser(fdp.Doc); fdp.AddMarkUp(drop.Content); FlowDocumentScrollViewer fdsv = new FlowDocumentScrollViewer() { HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled, Document = fdp.Doc, VerticalScrollBarVisibility = ScrollBarVisibility.Auto, Foreground = new SolidColorBrush(Colors.White) }; Border border = new Border() { BorderThickness = new Thickness(0, 5, 0, 5), CornerRadius = new CornerRadius(10), Padding = new Thickness(3), Background = new SolidColorBrush(Colors.Black), Cursor = Cursors.Hand, Child = fdsv }; fdp.Doc.PreviewMouseWheel += Bubbler; fdsv.PreviewMouseWheel += Bubbler; fdsv.SizeChanged += Resizer; sp.Children.Add(border); return fdp.Doc; }
public static FlowDocument Parse(string text) { FlowDocumentParser res = new FlowDocumentParser(); res.AddMarkUp(text); return res.Doc; }