如何以编程方式复制/粘贴在Windows Phone? [英] How to programmatically copy/paste in windows phone?
问题描述
可能重复:
是否可以编程使用新的WP7剪切和粘贴功能?
有没有办法以编程方式在Windows Phone中复制/粘贴文本。我想让用户点击一个按钮,应该自动复制一些文本到剪贴板。文本驻留在TextBlock控件(可能被隐藏)。我想到的唯一解决方法是弹出一个对话框,其中填充的文本TextBlock(本来支持复制粘贴)。
Is there a way to programmatically copy/paste text in windows phone. I want the user to click on a button that should automatically copy some text to the clipboard. The text resides on a TextBlock control (which may be hidden). The only workaround that I have thought of is to pop a dialog with the text filled in in a TextBlock (which natively supports copy paste).
想法?
推荐答案
设置文本: Clipboard.SetText(foo-bar)
要检查剪贴板是否包含文本: Clipboard.ContainsText(foo-bar)
To check if clipboard contains text : Clipboard.ContainsText("foo-bar")
没有方法获取文本 Clipboard.GetText()
导致安全异常
No method to to get text Clipboard.GetText()
results in Security Exception
这篇关于如何以编程方式复制/粘贴在Windows Phone?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!