0 While initializing,
var dtm = Windows.ApplicationModel.DataTransfer.DataTransferManager.GetForCurrentView();
dtm.DataRequested += Dtm_DataRequested;
private async void Dtm_DataRequested(Windows.ApplicationModel.DataTransfer.DataTransferManager sender, Windows.ApplicationModel.DataTransfer.DataRequestedEventArgs args)
{
DataPackage dataToShare = args.Request.Data;
dataToShare.Properties.Title = "Attachment Sharing Application";
dataToShare.Properties.Description = "Attachment Sharing Application that share images";var storageFile = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync("Assets\\abc.jpg");var imageStream = Windows.Storage.Streams.RandomAccessStreamReference.CreateFromFile(storageFile);
dataToShare.SetBitmap(imageStream);
}
private void btn_Share_Click(object sender, RoutedEventArgs e)
{
Windows.ApplicationModel.DataTransfer.DataTransferManager.ShowShareUI();
}
I have attached the complete working source code sample. If any confusion please refer this sample.
Thanks!