Class Clipboard

    Definition

    Namespace:
    Tizen.NUI
    Assembly:
    Tizen.NUI.dll

    This class provides methods to interact with the system clipboard, allowing users to get and set clipboard content.

    public class Clipboard : BaseHandle, IDynamicResourceHandler, INameScope, System.IDisposable
    Inheritance
    object
    BindableObject
    Element
    BaseHandle
    Clipboard
    Implements
    IDynamicResourceHandler
    INameScope
    System.IDisposable

    Properties

    View Source

    Instance

    Gets the singleton instance of Clipboard.

    Declaration
    public static Clipboard Instance { get; }
    Property Value
    Type Description
    Clipboard

    Methods

    View Source

    Dispose(bool)

    Declaration
    protected override void Dispose(bool disposing)
    Parameters
    Type Name Description
    bool disposing
    Overrides
    BaseHandle.Dispose(bool)
    View Source

    Dispose(DisposeTypes)

    Dispose. Releases unmanaged and optionally managed resources.

    Declaration
    protected override void Dispose(DisposeTypes type)
    Parameters
    Type Name Description
    DisposeTypes type

    Explicit to release both managed and unmanaged resources. Implicit to release only unmanaged resources.

    Overrides
    BaseHandle.Dispose(DisposeTypes)
    Remarks

    When overriding this method, you need to distinguish between explicit and implicit conditions. For explicit conditions, release both managed and unmanaged resources. For implicit conditions, only release unmanaged resources.

    View Source

    GetData(string, ClipboardCallback)

    Request get data of the specified mime type from clipboard
    and invokes the given callback with the received clipboard data.

    Declaration
    public void GetData(string mimeType, Clipboard.ClipboardCallback dataReceivedCallback)
    Parameters
    Type Name Description
    string mimeType

    The mime type of data to request.

    Clipboard.ClipboardCallback dataReceivedCallback

    The callback method to handle the received clipboard data.

    Remarks

    GetData() method is introduced to fetch data of the specified mime type,
    and it expects a callback function as a parameter.
    The given callback is invoked with received clipboard data.
    The callback is designed to be used only once for handling the data.

    Examples

    The following example demonstrates how to use the GetData and ClipboardCallback.

    string MIME_TYPE_PLAIN_TEXT = "text/plain;charset=utf-8";
    Clipboard.Instance.GetData(MIME_TYPE_PLAIN_TEXT, OnClipboardDataReceived);
    ...
    public void OnClipboardDataReceived(bool success, ClipEvent clipEvent)
    {
        if (!success) return;
        string mimeType = clipEvent.MimeType;
        string data = clipEvent.Data;
    }
    View Source

    SetData(string, string)

    Request set the given data to the clipboard.

    Declaration
    public bool SetData(string mimeType, string data)
    Parameters
    Type Name Description
    string mimeType

    The mime type of the data.

    string data

    The data to be set on the clipboard.

    Returns
    Type Description
    bool

    True if the internal clipboard sending request is successful.

    Examples

    The following example demonstrates how to use the SetData.

    string MIME_TYPE_PLAIN_TEXT = "text/plain;charset=utf-8";
    Clipboard.Instance.SetData(MIME_TYPE_PLAIN_TEXT, "Hello Clipboard");

    Events

    View Source

    DataSelected

    The DataSelected event is emitted when a copy event occurs somewhere.
    In order for this event to operate normally,
    the process using this event must be Secondary Selection.

    Declaration
    public event EventHandler<ClipboardDataSelectedEventArgs> DataSelected
    Event Type
    Type Description
    EventHandler<><ClipboardDataSelectedEventArgs>
    Examples

    The following example demonstrates how to use the DataSelected.

    kvmService.SetSecondarySelection(); // precondition
    
    Clipboard.Instance.DataSelected += (s, e) =>
    {
        string selectedType = e.MimeType;
    };

    Implements

    IDynamicResourceHandler
    INameScope
    System.IDisposable

    Extension Methods

    BindableObjectExtensions.SetBinding(BindableObject, BindableProperty, string, BindingMode, IValueConverter, string)
    NameScopeExtensions.FindByName<T>(Element, string)
    EXamlExtensions.LoadFromEXamlByRelativePath<T>(T, string)
    Extensions.LoadFromXaml<TXaml>(TXaml, string)
    Extensions.LoadFromXaml<TXaml>(TXaml, Type)
    Extensions.LoadFromXamlFile<TXaml>(TXaml, string)
    • View Source
    Back to top Copyright © 2016-2025 Samsung
    Generated by DocFX