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.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…