stavroskasidis / XamarinClipboardPlugin

Cross Platform Clipboard access for Xamarin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Clipboard Plugin for Xamarin, Windows & Gtk2

Simple cross platform plugin to read and write to the clipboard.

Setup

Supports

  • Xamarin.Android
  • Xamarin.iOS
  • Xamarin.Mac
  • Windows 10 UWP
  • Gtk# 2.12
  • WPF 4.7.2

API Usage

Call Plugin.Clipboard.CrossClipboard.Current from any project or .NET Standard library to gain access to APIs.

using Plugin.Clipboard;

...

//To set the clipboard
CrossClipboard.Current.SetText("my clipboard text");

//To read the clipboard
string clipboardText = await CrossClipboard.Current.GetTextAsync();

Using in unit tests

//Create mock with LightMock (https://github.com/seesharper/LightMock)
var mockClipboardContext = new MockContext<IClipboard>();
var mockClipboard = new CrossClipboardMock(mockClipboardContext);

CrossClipboard.Current = mockClipboard;

About

Cross Platform Clipboard access for Xamarin

License:MIT License


Languages

Language:C# 99.9%Language:Batchfile 0.1%