Xamarin形式:如何复制条目值? [英] Xamarin forms: How to copy an entry value?

查看:121
本文介绍了Xamarin形式:如何复制条目值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从我的应用程序中复制一个值,然后将其粘贴到同一应用程序的任何其他位置或应用程序外部.

I want to copy a value from my app and paste it any other place of the same app or outside of the app.

我已经在此线程中寻找了答案:

所以我使用了Clipboard.SetText(txtClipboard.Text);并添加了using System.Windows.Forms;using System.Windows;名称空间.但是,我收到一个错误:

So I used Clipboard.SetText(txtClipboard.Text); and added using System.Windows.Forms; and using System.Windows; namespaces. But, I am getting an error:

剪贴板在当前上下文中不存在.

clipboard does not exist in the current context.

是否需要任何nuget软件包?

Any nuget package need for this?

预先感谢

推荐答案

有一个用于Xamarin的剪贴板插件(支持的平台为iOS,Mac,Android,UWP和Gtk#).它支持以跨平台方式将文本保存到剪贴板或从剪贴板中获取文本.在此处.

There is a clipboard plugin for Xamarin (supported platforms are iOS, Mac, Android, UWP and Gtk#). It supports saving text to and getting it from the clipboard in a cross-platform way. The NuGet package is available here.

设置文字

CrossClipboard.Current.SetText("my clipboard text");

获取文字

string clipboardText = await CrossClipboard.Current.GetTextAsync();

这篇关于Xamarin形式:如何复制条目值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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