WPF 拖放不适用于空图像

发布于 2025-01-18 07:25:49 字数 242 浏览 2 评论 0原文

我想允许用户将图像从资源管理器拖放到空的 Image 上(未设置 Source 属性),并且我希望 Image默认情况下为空,但如果 Image 为空并且我的光标只是一个带有斜线的圆圈,则 Drop 事件将不会触发。我尝试向 Image 添加默认图像,效果很好。有什么办法可以让我完成这项工作或者有任何解决方法吗?

I want to allow the user to drop an image from explorer onto an empty Image(Source property not set), and I want the Image to be empty by default, but the Drop event will not fire if the Image is empty and my cursor will just be a circle with a slash. I tried adding a default image to the Image and it worked just fine. Is there any way I can make this work or are there any workarounds?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

萌无敌 2025-01-25 07:25:49

尝试在Image控件外面放一个布局容器,比如Grid,设置为透明,然后在容器中处理drop事件

try put a layout container, such as Grid, outside the Image control, set it to be transparent, and then handle the drop event in the container

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文