1111using System . Collections . Specialized ;
1212using System . IO ;
1313using System . Windows . Input ;
14+ using Vanara . PInvoke ;
1415using Windows . ApplicationModel . DataTransfer ;
1516using Windows . ApplicationModel . DataTransfer . DragDrop ;
1617using Windows . Storage ;
1718using Windows . System ;
1819using Windows . UI . Core ;
20+ using WinRT ;
1921
2022namespace Files . App . ViewModels . UserControls
2123{
@@ -1251,6 +1253,16 @@ private async Task HandleLocationItemDroppedAsync(LocationItem locationItem, Ite
12511253 await QuickAccessService . PinToSidebarAsync ( item . Path ) ;
12521254 }
12531255 }
1256+ else if ( ( bool ) args . DroppedItem . Properties . GetValueOrDefault ( "dragRightButton" , false ) )
1257+ {
1258+ Windows . Win32 . PInvoke . GetCursorPos ( out var dropPoint ) ;
1259+ using var sf = new Vanara . Windows . Shell . ShellFolder ( locationItem . Path ) ;
1260+ var dataObjectProvider = args . DroppedItem . As < Shell32 . IDataObjectProvider > ( ) ;
1261+ var iddo = dataObjectProvider . GetDataObject ( ) ;
1262+ var dropTarget = sf . GetViewObject < Ole32 . IDropTarget > ( HWND . NULL ) ;
1263+ dropTarget . DragEnter ( iddo , Vanara . PInvoke . MouseButtonState . MK_RBUTTON , new ( ) { X = dropPoint . X , Y = dropPoint . Y } , ( Ole32 . DROPEFFECT ) args . RawEvent . AcceptedOperation ) ;
1264+ dropTarget . Drop ( iddo , Vanara . PInvoke . MouseButtonState . MK_RBUTTON , new ( ) { X = dropPoint . X , Y = dropPoint . Y } , ( Ole32 . DROPEFFECT ) args . RawEvent . AcceptedOperation ) ;
1265+ }
12541266 else
12551267 {
12561268 await FilesystemHelpers . PerformOperationTypeAsync ( args . RawEvent . AcceptedOperation , args . DroppedItem , locationItem . Path , false , true ) ;
@@ -1260,7 +1272,21 @@ private async Task HandleLocationItemDroppedAsync(LocationItem locationItem, Ite
12601272
12611273 private Task < ReturnResult > HandleDriveItemDroppedAsync ( DriveItem driveItem , ItemDroppedEventArgs args )
12621274 {
1263- return FilesystemHelpers . PerformOperationTypeAsync ( args . RawEvent . AcceptedOperation , args . RawEvent . DataView , driveItem . Path , false , true ) ;
1275+ if ( ( bool ) args . DroppedItem . Properties . GetValueOrDefault ( "dragRightButton" , false ) )
1276+ {
1277+ Windows . Win32 . PInvoke . GetCursorPos ( out var dropPoint ) ;
1278+ using var sf = new Vanara . Windows . Shell . ShellFolder ( driveItem . Path ) ;
1279+ var dataObjectProvider = args . DroppedItem . As < Shell32 . IDataObjectProvider > ( ) ;
1280+ var iddo = dataObjectProvider . GetDataObject ( ) ;
1281+ var dropTarget = sf . GetViewObject < Ole32 . IDropTarget > ( HWND . NULL ) ;
1282+ dropTarget . DragEnter ( iddo , Vanara . PInvoke . MouseButtonState . MK_RBUTTON , new ( ) { X = dropPoint . X , Y = dropPoint . Y } , ( Ole32 . DROPEFFECT ) args . RawEvent . AcceptedOperation ) ;
1283+ dropTarget . Drop ( iddo , Vanara . PInvoke . MouseButtonState . MK_RBUTTON , new ( ) { X = dropPoint . X , Y = dropPoint . Y } , ( Ole32 . DROPEFFECT ) args . RawEvent . AcceptedOperation ) ;
1284+ return Task . FromResult ( ReturnResult . Success ) ;
1285+ }
1286+ else
1287+ {
1288+ return FilesystemHelpers . PerformOperationTypeAsync ( args . RawEvent . AcceptedOperation , args . RawEvent . DataView , driveItem . Path , false , true ) ;
1289+ }
12641290 }
12651291
12661292 private async Task HandleTagItemDroppedAsync ( FileTagItem fileTagItem , ItemDroppedEventArgs args )
0 commit comments