Silverlight:是否可以在文本框中对 XML 进行语法颜色?
您好,
我的 Silverlight 应用程序中有一些 XML存储在 String
中并希望输出给用户。 xml 已经“打印得很好”,因为它是用缩进格式化的,但如果我还可以向它添加语法着色,它将使阅读更加清晰。
这可以做到吗?我该如何去做呢? (请建议一个库或其他东西)
想一想,我什至不确定是否可以在.NET 界面中输出彩色文本...
谢谢您的见解!
(PS:我不在乎哪个版本的Silverlight)
Possible Duplicate:
Silverlight XML editor / syntax highlighting
Hello,
I have some XML in my Silverlight Application that I store in a String
and wish to output to the user. The xml is already "pretty printed" in the sense that it is formatted with indentations, but it would make it much clearer to read if I could also add syntax colouring to it.
Can this be done? How do I go about doing it? (please suggest a library or something)
Come to think of it, I'm not even sure if it's at all possible to output coloured text in a .NET interface...
Thank you for any insight!
(PS: I don't care which version of Silverlight)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我查看了一下,没有找到可以为 WinForms RichTextBox 进行 XML 语法突出显示的控件。这是为我构建的 XPath 评估器工具而设计的。 WinForms RichTextBox 当然具有显示颜色的功能,但我找不到足够智能的工具来突出显示 XML 语法。
我最终建造了一个。我使用的方法可能也适用于 WPF。
这是我如何到达那里的解释:
WinForms RichTextBox:如何异步重新格式化,不触发 TextChanged 事件
I looked and did not find a control that would do XML syntax highlighting for a WinForms RichTextBox. This was for an XPath evaluator tool I built. The WinForms RichTextBox has the capability to display colors of course, but I couldn't find one smart enough to highlight XML syntax.
I ended up building one. The approach I used would probably work for WPF as well.
This is the explanation for how I got there:
WinForms RichTextBox : how to reformat asynchronously, without firing TextChanged event