WebView.DataTransferPackage property

Applies to Windows and Windows Phone

[DataTransferPackage may be altered or unavailable for releases after Windows 8.1. Instead, use CaptureSelectedContentToDataPackageAsync.]

Gets a clipboard DataPackage as passed to the WebView.

Syntax


Public ReadOnly Property DataTransferPackage As DataPackage

Property value

Type: DataPackage

A clipboard data package.

Remarks

This property is typically used to support sharing. During a share operation, the source app puts the data being shared in a DataPackage object and sends that object to the target app for processing.

Examples

The following code example demonstrates how to use this property to implement sharing support.


Private Sub Share_Click(sender As Object, e As RoutedEventArgs)
    dataTransferManager = dataTransferManager.GetForCurrentView()
    AddHandler dataTransferManager.DataRequested, AddressOf dataTransferManager_DataRequested
    dataTransferManager.ShowShareUI()
End Sub

Private Sub dataTransferManager_DataRequested(sender As DataTransferManager, args As DataRequestedEventArgs)
    Dim request As DataRequest = args.Request
    Dim p As DataPackage = WebView7.DataTransferPackage

    If p.GetView().Contains(StandardDataFormats.Text) Then
        p.Properties.Title = "WebView Sharing Excerpt"
        p.Properties.Description = "This is a snippet from the content hosted in the WebView control"
        request.Data = p
    Else
        request.FailWithDisplayText("Nothing to share")
    End If
    RemoveHandler dataTransferManager.DataRequested, AddressOf dataTransferManager_DataRequested
End Sub


Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

End of client support

Windows 8.1

End of server support

Windows Server 2012 R2

Namespace

Windows.UI.Xaml.Controls
Windows::UI::Xaml::Controls [C++]

Metadata

Windows.winmd

See also

WebView
XAML WebView control sample

 

 

Show:
© 2014 Microsoft