WebView.DataTransferPackage 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
참고
DataTransferPackage는 Windows 8.1 후에 릴리스에 대해 변경되거나 사용할 수 없습니다. 대신 CaptureSelectedContentToDataPackageAsync를 사용합니다.
WebView에 전달된 클립보드 DataPackage를 가져옵니다.
public:
property DataPackage ^ DataTransferPackage { DataPackage ^ get(); };
/// [get: Windows.Foundation.Metadata.Deprecated("Use CaptureSelectedContentToDataPackageAsync instead of DataTransferPackage. For more info, see MSDN.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, Windows.Foundation.UniversalApiContract)]
DataPackage DataTransferPackage();
/// [get: Windows.Foundation.Metadata.Deprecated("Use CaptureSelectedContentToDataPackageAsync instead of DataTransferPackage. For more info, see MSDN.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.Foundation.UniversalApiContract")]
DataPackage DataTransferPackage();
public DataPackage DataTransferPackage { [Windows.Foundation.Metadata.Deprecated("Use CaptureSelectedContentToDataPackageAsync instead of DataTransferPackage. For more info, see MSDN.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, typeof(Windows.Foundation.UniversalApiContract))] get; }
public DataPackage DataTransferPackage { [Windows.Foundation.Metadata.Deprecated("Use CaptureSelectedContentToDataPackageAsync instead of DataTransferPackage. For more info, see MSDN.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.Foundation.UniversalApiContract")] get; }
var dataPackage = webView.dataTransferPackage;
Public ReadOnly Property DataTransferPackage As DataPackage
속성 값
클립보드 데이터 패키지입니다.
- 특성
예제
다음 코드 예제를 사용 하는 방법에 설명 합니다 공유 지원을 구현 하는이 속성입니다.
void SDKSample::WebViewControl::Scenario7::Share_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
dataTransferManager = DataTransferManager::GetForCurrentView();
dataRequestedToken = dataTransferManager->DataRequested += ref new TypedEventHandler<DataTransferManager^, DataRequestedEventArgs^>(this, &Scenario7::dataTransferManager_DataRequested);
DataTransferManager::ShowShareUI();
}
// Data requested handler
void SDKSample::WebViewControl::Scenario7::dataTransferManager_DataRequested(DataTransferManager^ sender, DataRequestedEventArgs^ args)
{
DataRequest^ request = args->Request;
DataPackage^ p = WebView7->DataTransferPackage;
if (p->GetView()->Contains(StandardDataFormats::Text))
{
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");
}
dataTransferManager->DataRequested -= dataRequestedToken;
}
private void Share_Click(object sender, RoutedEventArgs e)
{
dataTransferManager = DataTransferManager.GetForCurrentView();
dataTransferManager.DataRequested += dataTransferManager_DataRequested;
DataTransferManager.ShowShareUI();
}
void dataTransferManager_DataRequested(DataTransferManager sender, DataRequestedEventArgs args)
{
DataRequest request = args.Request;
DataPackage p = WebView7.DataTransferPackage;
if (p.GetView().Contains(StandardDataFormats.Text))
{
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");
}
dataTransferManager.DataRequested -= dataTransferManager_DataRequested;
}
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
설명
이 속성은 일반적으로 공유를 지원하는 데 사용됩니다. 공유 작업 중에 원본 앱은 공유되는 데이터를 DataPackage 개체에 두고 처리를 위해 해당 개체를 대상 앱으로 보냅니다.