Unable to use Undo in TextChanged

后端 未结 3 554
心在旅途
心在旅途 2021-01-04 14:34

When using textbox.Undo(); I get the following error:

Cannot Undo or Redo while undo unit is open.

Now I understand why this is

3条回答
  •  抹茶落季
    2021-01-04 14:41

    Call the undo asynchronously from the From the TextChanged event handler:

    Dispatcher.BeginInvoke(new Action(() => tb.Undo())) 
    

提交回复
热议问题