WPF Richtextbox撤消和重做操作,语法高亮 [英] WPF Richtextbox undo and Redo Operation with syntax hightlight

查看:182
本文介绍了WPF Richtextbox撤消和重做操作,语法高亮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的WPF应用程序之一中使用RichTextBox,用户在此富文本框中键入Text \ script,基于用户输入的标记,我将颜色,字体属性应用于后面代码中的输入文本(语法突出显示).

我需要执行撤消\重做"操作,但是如果我不更改color \ font属性,则发现默认的撤消操作效果很好,但是如果我在代码中更改了它们,那就行不通了.

I am using RichTextBox in one of my WPF Application, users types Text\script in this rich text box, based on the tokens entered by user i apply color, font property to the entered text in the code behind(Syntax highlighting).

I need to perform Undo\Redo Operations, but what i found is the default undo operation works well if i am not changing the color\font properties, but if i change them in my code , it doesn't work.

Richtextbox是否有问题?

Is there any issues with Richtextbox ?

推荐答案

你好,

由于我们不知道有关您的设置的详细信息,因此我无法对"Richtextbox是否存在任何问题?"这个问题说什么.

Since we don't know details about your setting, I cannot say anything to this question " Is there any issues with Richtextbox ?"

据我所知,对文本框类的撤消支持完全是内部的,我们需要注意以下几点:

Also as the undo support for the textbox classes is completely internal, as far as I know, we need to notice the following things:

IsUndoEnabled,UndoLimit,CanUndo,CanRedo,Undo()和Redo()

 IsUndoEnabled, UndoLimit, CanUndo, CanRedo, Undo(), and Redo()

您为他们设置了任何内容吗?

Have you set anything to them?

我仔细研究了这些内容,并在UndoLimit中找到了它:设置

I looked through those things and find this in UndoLimit: Setting UndoLimit clears the undo queue. Could this be the problem of your issue?

最诚挚的问候,


这篇关于WPF Richtextbox撤消和重做操作,语法高亮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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