使用MVVM更改richtextbox中文本的颜色 [英] Change color of a text in richtextbox using MVVM
问题描述
你好everyboby
我找不到解决这个问题的方法。我只是想能够使用mvvm在richTextBox中绑定文档,实际上我想要的是能够选择后面代码中不同单词的颜色。我试过这个richtextbox:扩展的WPF工具包™社区版 - 文档 [ ^ ]但我找不到如何更改tge颜色文本 ?也许有另一个控制谁可以做到这一点?
感谢您的帮助:)
祝您有个美好的一天!
我尝试过:
i尝试使用此工具包:扩展的WPF Toolkit™社区版 - 文档 [ ^ ]
还有:可绑定的WPF RichTextBox [ ^ ]
但没有成功....
hello everyboby
I can't find any solution to that problem. I just want to be able to bind a document in a richTextBox using mvvm, actually all i want is to be able to choose the color of the different words in the code behind. I have tried this richtextbox : Extended WPF Toolkit™ Community Edition - Documentation[^] but i can't find how to change tge color of the text ? maybe there is another control who could do that ?
thank for your help :)
have a good day !
What I have tried:
i tried to use this toolkit : Extended WPF Toolkit™ Community Edition - Documentation[^]
and also this : A Bindable WPF RichTextBox[^]
but no success....
推荐答案
似乎,使用RichtextBox来满足这种要求有点复杂。请阅读该问题的评论: c# - 如何以有效的方式将我的日志条目的不同部分标记为RichTextBox? - 堆栈溢出 [ ^ ]希望以不同的方式解决您的问题。按照评论中提供的链接;)
Seems, that using RichtextBox for such of requirement is bit complicated. Please read the comment to that question: c# - How can I color different parts of my log entries to a RichTextBox in an efficient way? - Stack Overflow[^] There's a hope to resolve your issue in a different way. Follow the link provided in the comment ;)
这篇关于使用MVVM更改richtextbox中文本的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!