I have been writing an IM client with WPF and have gotten stuck when I wanted to add emoticons. As input box(where the user types his/hers instant message) I use and RichTextBox. The problem I face is how to insert and emoticon at the CaretPosition when
the user selects en emoticon from a ComboxBox in the UI.
I have three cases where I want to insert the emoticons relative to a Inline:
1. The CaretPosition is at the start of an Inline and I want to insert before the Inline
2. The CaretPosition is at the end of an Inline and I want to insert after the Inline
3. The CaretPosition is inside an Inline. In this I want to split the Inline at the CaretPosition and insert an InlineUIContainer(Emoticon) and create 2 new Inlines before and after and then remove the original inline.
The code pasted I pasted is throwing two types of exception when the third case is true:
'start' not expected after 'end'.
'Run' PreviousSibling does not belong to this TextElementCollection.
Here's the code. Can anyone help me on this?
public ICommand InsertEmoticonCommand
View Complete Post