且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

[UWP]如何在Windows Phone上启用TextBox的撤消功能

更新时间:2022-10-25 09:33:25


你绝对可以记录由TextChanged事件手动创建历史记录。撤消命令用于显示先前的输入。似乎无法进入控制


处理TextBox中的ContextMenuOpening事件,您可以通过自己的命令修改Popup,例如您自己的撤消/重做历史记录。


一个好样本:  https://code.msdn.microsoft.com/windowsapps/Context-menu-sample-40840351  
与UWP一起正常工作。



希望它有用。


如果它对你有好处,你能否将这个答案标记为你的问题的答案
拜托?


在twitter上关注我:   https://twitter.com/NordineMhoumadi




跨度>


I use Windows.UI.Xaml.Controls.TextBox to create a edit box. On desktop platform, I can do undo with Ctrl+Z, or right click to pop up the context menu. But on a phone, how Can I do it? There's no Ctrl+Z. And a user doesn't have any way to call up the context menu.

You definitely can record the history manually by TextChanged event. Undo command is used to display the previously input. Hook into the control seems not possible.

Handle the ContextMenuOpening event from TextBox and you can modify the Popup by your own commands, for example your own undo/redo history.

A good sample: https://code.msdn.microsoft.com/windowsapps/Context-menu-sample-40840351 also works fine with UWP.

Hope it wil be useful.

If it's good for you, can you mark this answer as answer of your question please?

Follow me on twitter : https://twitter.com/NordineMhoumadi