Open Gavin-Williams opened 1 week ago
I works on my Windows 10 22H2 OS, Windows App SDK 1.6.240829007 :
private void Img1_DragStarting(UIElement sender, DragStartingEventArgs args)
{
args.AllowedOperations = Windows.ApplicationModel.DataTransfer.DataPackageOperation.Copy;
args.DragUI.SetContentFromBitmapImage(new BitmapImage(new Uri("ms-appx:///Assets/ButterflyBlue_small.png", UriKind.RelativeOrAbsolute)));
}
@castorix that works for me too. Ok, I've found the case where it doesn't work, and maybe there's something I don't understand about WinUI. If I use the BitmapImage beforehand as a source for another Image control, it doesn't work.
TestImage.Source = GlobalBitmapImage; // I see this.
args.DragUI.SetContentFromBitmapImage(GlobalBitmapImage); // I don't see this
Copilot and other resources say that I can use BitmapImage as a source for multiple items.
Describe the bug
When I set the visual for a drag and drop operation using...
args.DragUI.SetContentFromBitmapImage(bmp);
The image is not visible.
Steps to reproduce the bug
Expected behavior
I expect to see the image.
Screenshots
NuGet package version
WinUI 3 - Windows App SDK 1.6.1: 1.6.240923002
Windows version
Windows 11 (22H2): Build 22621
Additional context
DragUI.SetContentFromSoftwareBitmap() does not show the bitmap #4528
DataGridRow Drag and Drop Visual does not display most of the time #4545