1

How can I initialize paragraph Inline with new InlineCollection? I defined InlineCollection and added Run elements with string to it. I tried to initialize this way

ParagraphComponent.Inlines = _inlineCollection;

However, I get error message that ParagraphComponent.Inline is readonly.

Kapparino
  • 988
  • 11
  • 33

2 Answers2

1

You can't Inlines is read only
You will need to add the Runs directly to the paragraph

In XAML you can define Inlines

paparazzo
  • 44,497
  • 23
  • 105
  • 176
1

From the Remarks section of the Inlines property page on MSDN:

Use the InlineCollection returned by this property to enumerate or manipulate the contents of a Paragraph element.

So you could do this:

ParagraphComponent.Inlines.Clear();
ParagraphComponent.Inlines.AddRange(_inlineCollection);
Clemens
  • 123,504
  • 12
  • 155
  • 268