Question

I've created a chat application. But my problem is that I don't know how to implement smileys in a textbox.

Edited:

Basically I want to show an image in a textbox for specific keysequences, for example an image for :-D, :-), ;-) and so on.

Was it helpful?

Solution

Not a code solution but this should give you some ideas on 'How to implement' from your current starting position

Step 1. When you are binding the text, bind separate property or an IValueConverter that replaces any Smiley Characters you come across with a double Space which will leave a Gap where the smiley image needs to go.

Step 2. You will need to find where the smiley image needs to be place in the text (perhaps using measure Text), and then you will need to place an Image at the right location with the correct smiley image. You will probably have to write code to do this rather than data binding.

There defiantly a number of ways to do this, perhaps another way in Mango would be to use the new Rich Textbox instead: http://www.windowsphonegeek.com/articles/Windows-Phone-7-Mango-First-look-at-RichTextBox-control

OTHER TIPS

For on-screen keyboards, set the Keyboard Input Scope on the text box. Use the value of Text as shown here to get emoticons on the keyboard.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top