[UWP]如何在Windows Phone上启用TextBox的撤消功能 [英] [UWP]How to enable Undo of TextBox on a windows phone

查看:58
本文介绍了[UWP]如何在Windows Phone上启用TextBox的撤消功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Windows.UI.Xaml.Controls.TextBox创建一个编辑框。在桌面平台上,我可以使用Ctrl + Z进行撤消,或者右键单击以弹出上下文菜单。但是在手机上,我该怎么办呢?没有Ctrl + Z.并且用户无法通过
调用上下文菜单。
$

解决方案

< p style ="margin:0in 0in 12pt">


你绝对可以记录由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


这篇关于[UWP]如何在Windows Phone上启用TextBox的撤消功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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