Share via

DataRequestedEventArgs Class


Contains information about the DataRequested event. The system fires this event when the user invokes the Share 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)]
public sealed class DataRequestedEventArgs
Public NotInheritable Class DataRequestedEventArgs
Object Platform::Object IInspectable DataRequestedEventArgs

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in 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!");


When you use the DataTransferManager class to launch the Share UI programmatically, the system fires a DataRequested event. The object included with this event is an instance of the DataRequestedEventArgs class.

This event has one property, Request. This property contains an instance of the DataRequest class, which your app uses to supply the content the user wants to share with the target app.



Enables you to get the DataRequest object and either give it data or a failure message.

Applies to