I need to display list of objects in FlowDocument. I don't want to add it programmatically, but want to pass this list of objects via binding. For example:
<RichTextBox>
<FlowDocument>
<ItemsControl ItemsSource="{Binding Lines}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Paragraph>
<TextBox Text="{Binding Text}" />
</Paragraph>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</FlowDocument>
</RichTextBox>
There list of objects contains simple object like:
public class Line
{
public string Text { get; set; }
}
Thank you for your time and help!
Best regards, Alex
You can use the code below:
Lines should be of type IEnumerable/ObservableCollection.