1
1
// Copyright (c) 2023 Files Community
2
2
// Licensed under the MIT License. See the LICENSE.
3
3
4
- using CommunityToolkit . Mvvm . DependencyInjection ;
5
- using CommunityToolkit . Mvvm . Input ;
6
- using Files . App . Extensions ;
7
- using Files . App . Filesystem ;
8
- using Files . App . Helpers ;
9
4
using Files . App . Helpers . ContextFlyouts ;
10
- using Files . App . ViewModels ;
11
5
using Files . App . ViewModels . Widgets ;
12
- using Files . Backend . Services . Settings ;
13
- using Files . Shared . Extensions ;
14
- using Microsoft . Extensions . Logging ;
15
6
using Microsoft . UI . Xaml ;
16
7
using Microsoft . UI . Xaml . Controls ;
17
8
using Microsoft . UI . Xaml . Controls . Primitives ;
18
9
using Microsoft . UI . Xaml . Input ;
19
- using System ;
20
- using System . Collections . Generic ;
21
10
using System . IO ;
22
- using System . Linq ;
23
- using System . Threading . Tasks ;
24
11
using System . Windows . Input ;
25
12
using Windows . Storage ;
26
13
@@ -109,15 +96,13 @@ private async void FileTagItem_ItemClick(object sender, ItemClickEventArgs e)
109
96
await itemViewModel . ClickCommand . ExecuteAsync ( null ) ;
110
97
}
111
98
112
- private async void Item_RightTapped ( object sender , RightTappedRoutedEventArgs e )
99
+ private async void AdaptiveGridView_RightTapped ( object sender , RightTappedRoutedEventArgs e )
113
100
{
114
- App . Logger . LogWarning ( "rightTapped" ) ;
115
101
var itemContextMenuFlyout = new CommandBarFlyout { Placement = FlyoutPlacementMode . Full } ;
116
102
itemContextMenuFlyout . Opening += ( sender , e ) => App . LastOpenedFlyout = sender as CommandBarFlyout ;
117
- if ( sender is not StackPanel tagsItemsStackPanel || tagsItemsStackPanel . DataContext is not FileTagsItemViewModel item )
103
+ if ( e . OriginalSource is not FrameworkElement element || element . DataContext is not FileTagsItemViewModel item )
118
104
return ;
119
105
120
- App . Logger . LogWarning ( "Item path: " + item . Path + " widgetcarditem.path = " + ( item as WidgetCardItem ) ? . Path ) ;
121
106
var menuItems = GetItemMenuItems ( item , QuickAccessService . IsItemPinned ( item . Path ) , item . IsFolder ) ;
122
107
var ( _, secondaryElements ) = ItemModelListToContextFlyoutHelper . GetAppBarItemsFromModel ( menuItems ) ;
123
108
@@ -127,7 +112,7 @@ private async void Item_RightTapped(object sender, RightTappedRoutedEventArgs e)
127
112
128
113
secondaryElements . ForEach ( i => itemContextMenuFlyout . SecondaryCommands . Add ( i ) ) ;
129
114
ItemContextMenuFlyout = itemContextMenuFlyout ;
130
- itemContextMenuFlyout . ShowAt ( tagsItemsStackPanel , new FlyoutShowOptions { Position = e . GetPosition ( tagsItemsStackPanel ) } ) ;
115
+ itemContextMenuFlyout . ShowAt ( element , new FlyoutShowOptions { Position = e . GetPosition ( element ) } ) ;
131
116
132
117
await ShellContextmenuHelper . LoadShellMenuItems ( item . Path , itemContextMenuFlyout , showOpenWithMenu : true , showSendToMenu : true ) ;
133
118
e . Handled = true ;
0 commit comments