在用户键入期间将文本转换为带微笑的文本 [英] Convert Text to Text with Smiles during user typing

查看:96
本文介绍了在用户键入期间将文本转换为带微笑的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 您好,我尝试解决此问题.我具有用于文本和文档属性的可绑定richTextBox,此控件派生自Extended WPF Toolkit的richTextBox.

我的情况是:用户正在向richTextBox输入一些文本,如果他写了文本表情,我想将此文本表情转换为图像表情,并在richTextBox中显示给他.

例如:Hello world :)->世界您好IMAGE_SMILE

我有自己的类,可以将带有表情符号的字符串转换为带有文本和图像的段落类型.

在这里:

 Hi,I try solve this problem. I have bindable richTextBox for Text and Document properties, this control is derived from richTextBox from Extended WPF Toolkit.

My scenario is : User is typing some text to richTextBox, if he wrote text emoticons I want convert this text emoticons to image emoticons and show him in richTextBox.

For example: Hello world :) -> Hello world IMAGE_SMILE

I have own class which convert string with emoticons to type of Paragraph with text and images.

Here ist it:


public Paragraph ConvertToMessageWithEmoticons(string rpText){...}

推荐答案

您好jminarik,

Hi jminarik,

我不确定您是否通过之一实现RichTextBox? 扩展的WPF工具包(感谢大脑开发了这个好的库).但是似乎Text属性仍显示在控件上,并且它的优先级高于Document属性.您能否尝试清理文本 属性,并独立设置Document属性.

I am not sure hwo do you implement the RichTextBox form the one of the Extended WPF Toolkit (Thanks brain for developing this good library). But it seems the Text property is still shown on the control, and it has the higher priority than the Document property. Could you please try to clean the Text property and set the Document property independently.

另一方面,我认为直接操作FlowDocument比在一个RichTextBox中更改两个属性作为您的上一个线程要容易得多:http://social.msdn.microsoft.com/Forums/en/wpf/thread/86902bf5-72d4-41de-89ab- 3bc20200d44c

And on the other hand, I think operating the FlowDocument directly is easier than to change two properties in one RichTextBox as your previous thread: http://social.msdn.microsoft.com/Forums/en/wpf/thread/86902bf5-72d4-41de-89ab-3bc20200d44c

此致


这篇关于在用户键入期间将文本转换为带微笑的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆