Reputation: 23
i have a client/server chatroom setup and i want to replace pieces of text with images (":)", ":P", etc) dynamically, and i know it can be done with the Paragraph class, however the problem here for me is that whenever i add the paragraph to the richtextbox's document block it creates a line break before inserting the image (and to my knowledge, this aspect cannot be modified).
the chat line is already being manipulated in multiple ways (multiple colored portions of text, sporadic line breaks) before i get to the point of parsing emoticons, so creating one Paragraph instance for the entire line also doesnt seem viable.
i have tried setting the image to the clipboard and pasting it, however the idea of this doesnt sit well with me, and i have also run into problems with the images overwriting text and some other things.
i am looking for an alternative to the Paragraph class (or solution/workaround to my current setup) for inserting an image in between text in a richtextbox.
thanks
Upvotes: 2
Views: 1831
Reputation: 4885
Handle the text changed event and insert the images in between the text. The following article will help you,
http://wpfplayground.blogspot.in/2013/05/wpf-richtextbox-supporting-smileys.html
Upvotes: 1