DataRequestedEventArgs クラス

定義

DataRequested イベントに関する情報が含まれます。 ユーザーが共有 UI を呼び出すと、システムによってこのイベントが発生します。

public ref class DataRequestedEventArgs sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class DataRequestedEventArgs final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class DataRequestedEventArgs
Public NotInheritable Class DataRequestedEventArgs
継承
Object Platform::Object IInspectable DataRequestedEventArgs
属性

Windows の要件

デバイス ファミリ
Windows 10 (10.0.10240.0 で導入)
API contract
Windows.Foundation.UniversalApiContract (v1.0 で導入)

//To see this code in action, add a call to ShareSourceLoad to your constructor or other
//initializing function.
private void ShareSourceLoad()
{
    DataTransferManager dataTransferManager = DataTransferManager.GetForCurrentView();
    dataTransferManager.DataRequested += new TypedEventHandler<DataTransferManager, DataRequestedEventArgs>(this.DataRequested);
}

private void DataRequested(DataTransferManager sender, DataRequestedEventArgs e)
{
    DataRequest request = e.Request;
    request.Data.Properties.Title = "Share Text Example";
    request.Data.Properties.Description = "An example of how to share text.";
    request.Data.SetText("Hello World!");
}

注釈

DataTransferManager クラスを使用してプログラムで共有 UI を起動すると、システムによって DataRequested イベントが発生します。 このイベントに含まれるオブジェクトは、 DataRequestedEventArgs クラスのインスタンスです。

このイベントには、Request という 1 つのプロパティ があります。 このプロパティには DataRequest クラスのインスタンスが含まれています。これは、ユーザーがターゲット アプリと共有するコンテンツをアプリが提供するために使用します。

プロパティ

Request

DataRequest オブジェクトを取得し、データまたはエラー メッセージを渡します。

適用対象