Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Rather strange but I'm at my wit's end. I have this DragOver handler, practically out of the book:

  e.DragUIOverride.Caption = "my text";
  var op = DataPackageOperation.None;

  if (e.DataView.Contains(StandardDataFormats.StorageItems)) {
    var items = await e.DataView.GetStorageItemsAsync();
    if (items.Any()) {
      var file = items.First() as StorageFile;
      op = (file?.FileType == ".myext") ? DataPackageOperation.Copy : DataPackageOperation.None;
    }
  }

  System.Diagnostics.Trace.WriteLine(op);
  e.AcceptedOperation = op;

The reason for op is to avoid setting the AcceptedOperation twice (not normally required in samples but one of my desperate attempts). The trace at the end shows that this code sets the exact operation I need, no chance of failure. Yet, when running, all I get is a No Entry sign denoting a denied drag operation.

W10 20H2, for what it's worth.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
831 views
Welcome To Ask or Share your Answers For Others

1 Answer

等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...