DataTransferManager UI 中没有内容 [英] No content in DataTransferManager UI

查看:33
本文介绍了DataTransferManager UI 中没有内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Win32 桌面桥应用程序中使用 DataTransferManager 来共享文本和链接.我正在使用示例代码

加载 DataTransferManagerHelper

IntPtr hwnd = new WindowInteropHelper(Application.Current.MainWindow).Handle;var dtm = DataTransferManagerHelper.GetForWindow(hwnd);dtm.DataRequested += OnDataRequested;

显示共享界面

IntPtr hwnd = new WindowInteropHelper(Application.Current.MainWindow).Handle;DataTransferManagerHelper.ShowShareUIForWindow(hwnd);

解决方案

我能够找到错误.我实际上并没有调用这些方法

DataTransferManagerHelper.GetForWindow(hwnd);dtm.DataRequested += OnDataRequested;

确保调用这两个方法,否则您将看到无内容"共享对话框.

I am using the DataTransferManager in my Win32 Desktop Bridge App to share text and links. I am using the samplecode from Microsofts Code examples (github) However the share dialog is empty (see image, its says "Try again, Could not show all available methods to share").

Loading DataTransferManagerHelper

IntPtr hwnd = new WindowInteropHelper(Application.Current.MainWindow).Handle;
var dtm = DataTransferManagerHelper.GetForWindow(hwnd);
dtm.DataRequested += OnDataRequested;

Showing Share UI

IntPtr hwnd = new WindowInteropHelper(Application.Current.MainWindow).Handle;
DataTransferManagerHelper.ShowShareUIForWindow(hwnd);

解决方案

I was able to find the bug. I was not actually calling the methods

DataTransferManagerHelper.GetForWindow(hwnd);
dtm.DataRequested += OnDataRequested;

Makes sure that these two methods get called otherwise you will get the "no content" share dialog.

这篇关于DataTransferManager UI 中没有内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆