Class Clipboard
Provides cut, copy, and paste support for the OS clipboard.
Inheritance
System.Object
Clipboard
Remarks
On Windows, the Clipboard class uses the Windows Clipboard APIs via P/Invoke.
On Linux, when not running under Windows Subsystem for Linux (WSL), the Clipboard class uses the xclip command line tool. If xclip is not installed, the clipboard will not work.
On Linux, when running under Windows Subsystem for Linux (WSL), the Clipboard class launches Windows' powershell.exe via WSL interop and uses the "Set-Clipboard" and "Get-Clipboard" Powershell CmdLets.
On the Mac, the Clipboard class uses the MacO OS X pbcopy and pbpaste command line tools and the Mac clipboard APIs vai P/Invoke.
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Terminal.Gui
Assembly: Terminal.Gui.dll
Syntax
public static class Clipboard
Properties
| Improve this Doc View SourceContents
Gets (copies from) or sets (pastes to) the contents of the OS clipboard.
Declaration
public static ustring Contents { get; set; }
Property Value
Type | Description |
---|---|
ustring |
IsSupported
Returns true if the environmental dependencies are in place to interact with the OS clipboard.
Declaration
public static bool IsSupported { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
| Improve this Doc View SourceTryGetClipboardData(out String)
Copies the contents of the OS clipboard to
result
if possible.
Declaration
public static bool TryGetClipboardData(out string result)
Parameters
Type | Name | Description |
---|---|---|
System.String | result | The contents of the OS clipboard if successful, System.String.Empty if not. |
Returns
Type | Description |
---|---|
System.Boolean | true the OS clipboard was retrieved, false otherwise. |
TrySetClipboardData(String)
Pastes the
text
to the OS clipboard if possible.
Declaration
public static bool TrySetClipboardData(string text)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | The text to paste to the OS clipboard. |
Returns
Type | Description |
---|---|
System.Boolean | true the OS clipboard was set, false otherwise. |