开发者

WPF drag and drop: need a big flat drop target

开发者 https://www.devze.com 2023-01-26 19:50 出处:网络
I am trying to implement a very simple application where you drop a file anywhere in the client area and it gets converted. Here\'s my XAML:

I am trying to implement a very simple application where you drop a file anywhere in the client area and it gets converted. Here's my XAML:

<Grid AllowDrop="True">
  <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center">
    Drop .dds files here and they will be converted to .png files in their original directory
  </TextBlock>
</Grid>

However, when I do this the only allowable drop target is the <TextBlock>, not the rest of the big flat white space. When I put a file over any area where there's not text, I get a "no" cursor an开发者_StackOverflow社区d the drop event does not get triggered.

How can I bend WPF to my will? Why is it doing this to me?


I have no idea why, but if you set AllowDrop="True" on the parent of the grid it works as expected.

0

精彩评论

暂无评论...
验证码 换一张
取 消