[Handler(Clipboard.IHandler)] public class Clipboard : Widget, IDataObject
Object to handle the system clipboard. Use Instance to avoid creating multiple copies of this object.

Fields

ChangedEvent

#Since v2.12
public const string ChangedEvent = "Clipboard.Changed"
Identifier for handlers when attaching the Changed event.

Properties

ContainsHtml

#
public bool ContainsHtml { get; }
Gets a value indicating whether this Clipboard contains a value for Html.

ContainsImage

#
public bool ContainsImage { get; }
Gets a value indicating whether this Clipboard contains a value for Image.
true if the data object contains an image; otherwise, false.
ContainsImage

ContainsText

#
public bool ContainsText { get; }
Gets a value indicating whether this Clipboard contains a value for Text.

ContainsUris

#
public bool ContainsUris { get; }
Gets a value indicating whether this Clipboard contains a value for Uris.
Remarks: This can be a mix of both URL and File objects. You can use Uri.IsFile to test for that. On some platforms, (e.g. windows), only a single URL can be retrieved or set.
true if the data object contains uris; otherwise, false.
ContainsUris

ControlObject

public object ControlObject { get; }
Gets the instance of the platform-specific object
inherited fromWidget
Remarks: This can sometimes be useful to get the platform-specific object. Some handlers may not have any backing object for its functionality, so this may be null. It is more preferred to use the Widget.Handler and cast that to the platform-specific handler class which can give you additional methods and helpers to do common tasks. For example, the Application object's handler for OS X has a AddFullScreenMenuItem property to specify if you want full screen support in your app.

Handler

public object Handler { get; }
Gets the platform-specific handler for this widget
inherited fromWidget

Html

#
public string Html { get; set; }
Gets or sets html text in the clipboard.
The html value in the clipboard, or null if no html in the clipboard.
Html

Image

#
public Image Image { get; set; }
Gets or sets an image in the clipboard.
The image in the clipboard, or null if no image is in the clipboard.
Image

Instance

#
public static Clipboard Instance { get; }
Gets the shared clipboard instance

IsDisposed

public bool IsDisposed { get; }
Gets or sets a value indicating whether this Widget has been disposed.
inherited fromWidget
Remarks: When the widget is disposed, it can no longer be used.
true if this instance has been disposed; otherwise, false.

NativeHandle

public nint NativeHandle { get; }
Gets the native platform-specific handle for integration purposes
inherited fromWidget

Platform

public Platform Platform { get; }
Gets the platform that was used to create the Widget.Handler for this widget
inherited fromWidget
Remarks: This gets set to the current Platform.Instance during the construction of the object

Properties

public PropertyStore Properties { get; }
Gets the dictionary of properties for this widget
inherited fromWidget

Style

public string Style { get; set; }
Gets or sets the style of this widget
inherited fromWidget
Remarks: Styles allow you to attach custom platform-specific logic to a widget. In your platform-specific assembly, use Add{H} to add the style logic with the same id.
// in your UI
var control = new Button { Style = "mystyle" };

// in your platform assembly
using Eto.Mac.Forms.Controls;

Styles.AddHandler<ButtonHandler>("mystyle", handler => {
	// this is where you can use handler.Control to set properties, handle events, etc.
	handler.Control.BezelStyle = NSBezelStyle.SmallSquare;
});

Text

#
public string Text { get; set; }
Gets or sets the plain text in the clipboard.
The plain text in the clipboard, or null if no plain text string in the clipboard.
Text

Types

#
public string[] Types { get; }
Gets the type id's for each type of data in the clipboard.

Uris

#
public Uri[] Uris { get; set; }
Gets or sets the Uri's of the files in the clipboard.
The uris of the files, or null if no files are in the clipboard.
Uris

Methods

Clear

#
public void Clear()
Clears the clipboard completely of all values

Contains

#
public bool Contains(string type)
Gets a value indicating that data with the specified type is contained in the clipboard.
type (string)Type to test.
true if the clipboard contains the specified type, false otherwise.
Contains

Dispose

protected virtual void Dispose(bool disposing)
Handles the disposal of this widget
inherited fromWidget
disposing (bool)True if the caller called Widget.Dispose() manually, false if being called from a finalizer

GetCallback

#
protected override object GetCallback()
Gets an instance of an object used to perform callbacks to the widget from handler implementations
Remarks: The callback should implement the parent class' Widget.ICallback interface so that there only needs to be a single callback for the entire hierarchy. This should return a static instance to avoid having overhead for each instance of your control.
The callback instance to use for this widget

GetData

#
public byte[] GetData(string type)
Gets a data array from the clipboard with the specified type identifier.
type (string)Type identifier that was used to store the data.
The data array, or null if not found in the clipboard.
GetData

GetDataStream

#
public Stream GetDataStream(string type)
Gets the data stream with the specified type identifier.
type (string)Type identifier that was used to store the data.
The data stream if found, or null otherwise.

GetObject

#
public object GetObject(string type, Type objectType)
Gets an object from the data object with the specified type
Remarks: This is useful when you know the type of object, and it is serializable or has a type converter to convert from string. If it cannot be converted it will return the default value.
type (string)Type identifier to get from the data object
objectType (Type)Type of the object to get, or null to detect type
An instance of the object to recieve, or the default value.
GetObject

GetObject

#
public object GetObject(string type)
Gets a serialized value with the specified type identifier.
type (string)type identifier to get the value for.
Value of the object if deserializable, otherwise null.
GetObject

GetObject<T>

#
public T GetObject<T>(string type)
Gets an object from the data object with the specified type
Remarks: This is useful when you know the type of object, and it is serializable or has a type converter to convert from string. If it cannot be converted it will return the default value.
type (string)Type identifier to get from the data object
An instance of the object to recieve, or the default value.
GetObject

GetString

#
public string GetString(string type)
Gets a string from the clipboard with the specified type identifier.
type (string)Type identifier that was used to store the data.
The string.
GetString

Initialize

protected void Initialize()
Initializes the widget handler
inherited fromWidget
Remarks: This is typically called from the constructor after all of the logic is completed to construct the object. If your handler interface has the AutoInitializeAttribute set to false, then you are responsible for calling this method in your constructor after calling the creation method on your custom handler.

OnChanged

#Since v2.12
protected virtual void OnChanged(EventArgs e)
Raises the Changed event.

OnStyleChanged

protected virtual void OnStyleChanged(EventArgs e)
Handles when the Widget.Style is changed.
inherited fromWidget

SetData

#
public void SetData(byte[] value, string type)
sets a data array into the clipboard with the specified type identifier.
value (byte[])Data to store in the clipboard.
type (string)Type identifier to store the data.
SetData

SetDataStream

#
public void SetDataStream(Stream stream, string type)
Sets a data stream into the clipboard with the specified type identifier.
stream (Stream)Stream to store in the clipboard.
type (string)Type identifier when retrieving the stream.

SetObject

#
public void SetObject(object value, string type)
Sets the value into the data object with the specified type using serialization or type converter
Remarks: The object specified must be serializable or have a type converter to convert to a string.
value (object)Serializable value to set as a value in the data object
type (string)Type identifier to set the value for
SetObject

SetString

#
public void SetString(string value, string type)
Sets a string into the clipboard with the specified type identifier.
Remarks: This is useful when setting alternate string values into the clipboard that are not plain text. If you are storing plain text, use the Text property instead.
value (string)Value to set in the clipboard.
type (string)Type identifier that was used to store the data.
SetString

ToString

public override string ToString()
Gets a string that represents the current object with its ID if specified.
inherited fromWidget
A string value indicating the type and ID (if specified) of this widget.
Object.ToString

Events