I want to copy a value from my app and paste it any other place of the same app or outside of the app.
I already looked for an answer in this thread:
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.
Any nuget package need for this?
Thanks in advance
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.
To set text
CrossClipboard.Current.SetText("my clipboard text");
To get text
string clipboardText = await CrossClipboard.Current.GetTextAsync();