积极答复者
windows phone 获取粘贴板内容(Clipboard.GetText())出错 (不被允许)请问怎样能获取粘贴板内容

问题
-
我是这样写的
if (Clipboard.ContainsText())
{
this.content.Text = Clipboard.GetText();
}执行到Clipboard.GetText(); 报错!
一下是错误信息
System.Security.SecurityException was unhandled
Message=Clipboard access is not allowed
StackTrace:
at MS.Internal.XcpImports.Clipboard_GetText()
at System.Windows.Clipboard.GetText()
at xiaojiaoyanotes.addnote.button1_Click(Object sender, RoutedEventArgs e)
at System.Windows.Controls.Primitives.ButtonBase.OnClick()
at System.Windows.Controls.Button.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)
2012年4月3日 10:26
答案
-
的确是这样的,出于安全考虑,微软禁止App开发者获得剪切板的内容。所以剪切板里的内容是只能set无法get的。
- 已建议为答案 Shi Ding 2012年4月4日 2:37
- 已标记为答案 drivdreams 2012年4月4日 4:34
2012年4月3日 14:49 -
您好
Silverlight for Windows PhoneYou cannot get clipboard text from a Windows Phone application, only set it. Calling the GetText method in a Windows Phone application will always cause a SecurityException to occur.
歡迎參觀我的Blog.NET菜鳥自救會
- 已建议为答案 Shi Ding 2012年4月4日 2:37
- 已标记为答案 drivdreams 2012年4月4日 4:33
2012年4月3日 20:01
全部回复
-
的确是这样的,出于安全考虑,微软禁止App开发者获得剪切板的内容。所以剪切板里的内容是只能set无法get的。
- 已建议为答案 Shi Ding 2012年4月4日 2:37
- 已标记为答案 drivdreams 2012年4月4日 4:34
2012年4月3日 14:49 -
您好
Silverlight for Windows PhoneYou cannot get clipboard text from a Windows Phone application, only set it. Calling the GetText method in a Windows Phone application will always cause a SecurityException to occur.
歡迎參觀我的Blog.NET菜鳥自救會
- 已建议为答案 Shi Ding 2012年4月4日 2:37
- 已标记为答案 drivdreams 2012年4月4日 4:33
2012年4月3日 20:01