samhocevar/emoji.wpf

Selection changed only fires once

r-work opened this issue · 2 comments

if you select X emoji, SelectionChanged fires, if you open the picker again click the same emoji, it closes without firing SelectionChanged, this sort of makes sense as you're selecting the same emoji, but that becomes an issue if you're using the SelectionChanged to insert selected emojis into the RichTextBox.

Thanks for the suggestion! What do you think about this new event?

public event EmojiPickedEventHandler Picked;

Usage example:

EmojiPicker.Picked += (o, e) =>
    EmojiRichTextBox.CaretPosition.InsertTextInRun(e.Emoji);

Just tried it, works great, thank you!