DataTransferManager.DataRequested | datarequested event

Applies to Windows and Windows Phone

Occurs when a share operation starts.


public event TypedEventHandler<DataTransferManager, DataRequestedEventArgs> DataRequested

Event information

Delegate TypedEventHandler<DataTransferManager, DataRequestedEventArgs>


This event is fired when a sharing operation starts—typically when the user taps the Share charm, although it is also fired if your app starts a share operation programmatically. To handle this event, you need to add an event listener to the DataTransferManager object for the active window. You can get this object through the GetForCurrentView method.

When handling a datarequested event, the most important property you need to be aware of is its request property. This property contains a DataRequest object. Your app uses this object to provide the data that the user wants to share with a selected target app.


This example uses an inline function to handle a datarequested event.

//To see this code in action, add a call to ShareSouceLoad 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!");


Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8


Windows::ApplicationModel::DataTransfer [C++]



See also




© 2014 Microsoft