当前位置: 代码迷 >> Windows Mobile >> windows phone 的粘贴板如何调用啊 小弟我调用如何不被允许 需要申请吗
  详细解决方案

windows phone 的粘贴板如何调用啊 小弟我调用如何不被允许 需要申请吗

热度:52   发布时间:2016-04-25 07:41:34.0
windows phone 的粘贴板怎么调用啊 我调用怎么不被允许 需要申请吗?
if (Clipboard.ContainsText())
  {
  this.content.Text = Clipboard.GetText();
  }
 我是这样调用的想读取粘贴板的内容 但报错 说不被允许 为什么? 请各位大神帮帮忙啊!
Clipboard access is not allowed

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)


------解决方案--------------------
wp7上剪贴板只能set不能get

http://msdn.microsoft.com/zh-tw/library/ms597033(v=vs.95).aspx
Silverlight for Windows Phone

You 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.
------解决方案--------------------
可能因为安全原因只能用户自己粘贴时用
  相关解决方案