This question seems to require something similar to what you want. The answer here is to prove what you want.
Answer summary: use a FlowDocument , as in the following example:
<FlowDocument> <Paragraph> <Floater HorizontalAlignment="Left"> <BlockUIContainer> <Image Source="/FlowDocumentTest;component/dog.png" Width="100" /> </BlockUIContainer> </Floater> Here is where the text goes to wrap around the image. </Paragraph> </FlowDocument>
Update
As your question says, you are now using C # code to generate TextBlock / Run Elements, both can be children of a Paragraph object. So just name your Paragraph like this:
<FlowDocument> <Paragraph x:Name="textPara"> <Floater HorizontalAlignment="Left"> <BlockUIContainer> <Image Source="/FlowDocumentTest;component/dog.png" Width="100" /> </BlockUIContainer> </Floater> </Paragraph> </FlowDocument>
Then in C # add your generated TextBlock or Run to the Inlines textPara property, i.e.
var runToInsert = new Run("Some text to display"); textPara.Inlines.InsertAfter(textPara.Inlines.FirstInline, runToInsert);
Lukazoid
source share