You need to be able to add images to the application by dragging from the file system
Grid turned on AllowDrop . But how to add drag and drop images to the collection? Because Those examples that I have seen add images only to codebeehind.
Wrote method in control
private void Grid_DragOver(object sender, DragEventArgs e) { e.AcceptedOperation = DataPackageOperation.Copy; if (e.DragUIOverride != null) { e.DragUIOverride.Caption = "Add file"; e.DragUIOverride.IsContentVisible = true; } } XAML
<Grid Width="2560" Height="1600" Margin="0,0,0,0" AllowDrop="True" Drop=" " DragOver="Grid_DragOver" VerticalAlignment="Center" HorizontalAlignment="Center"> <Image Width="525" Height="331" Tapped="Image_Tapped" Source="{x:Bind Image}" Margin="{x:Bind Margins}" DoubleTapped="Image_DoubleTapped" RightTapped="Image_RightTapped" ManipulationDelta="Image_ManipulationDelta" ManipulationMode="TranslateX, TranslateY,Rotate,Scale"> <Image.RenderTransform> <CompositeTransform/> </Image.RenderTransform> </Image> The Drop method is sent to the team on the VM, there, in theory, I should add the received pictures to the ObservableCollection in which they are stored. (The application should have 2 types of loading pictures, through picker and drop). I do not understand how I get them there. I can not with the View in the VM to pass the argument DragEventArgs e or can I?