I\'m new to WPF and I\'ve found some similar questions but can\'t quite figure out the last part. I have a ViewModel with an ObservableCollection that contains error messag
May be usefull to generate FlowDocument and show this document in FlowDocumentReader. Try to start from this article: Flow Document Overview.
Example of generation:
void ShowErrors(FlowDocumentReader reader, Exception[] errors) {
FlowDocument doc = new FlowDocument();
foreach (var e in errors) {
doc.Blocks.Add(new Paragraph(new Run(e.GetType().Name)) {
Style = (Style)this.FindResource("header")
});
doc.Blocks.Add(new Paragraph(new Run(e.Message)) {
Style = (Style)this.FindResource("text")
});
}
reader.Document = doc;
}
In this example I have added some styles for text in flowdocument. PLease look at XAML:
Result: