How to get the count of undoable operation of a wpf richtextbox
how can i track the number of undo operation of a wpf richtext开发者_运维技巧box?
You can't do that. Undo logic is private inside TextBoxBase
class and it depends on internal UndoManager
class. I advise you not to hack with Reflection, because your code can break if MS decides to change implementation, but if you decide to do it anyway, you can use Reflector to get code of TextBoxBase.CanUndo
property to understand how it works. Number of available undo operations is probably in the UndoManager.UndoCount
property, but there's additional logic you need to consider.
精彩评论