@@ -194,13 +194,27 @@ public bool RecycleBinHasItems
194
194
}
195
195
}
196
196
197
+ public INavigationControlItem RightClickedItem ;
198
+
197
199
public event PropertyChangedEventHandler PropertyChanged ;
198
200
199
201
private void NotifyPropertyChanged ( [ CallerMemberName ] string propertyName = "" )
200
202
{
201
203
PropertyChanged ? . Invoke ( this , new PropertyChangedEventArgs ( propertyName ) ) ;
202
204
}
203
205
206
+ public void UnpinItem_Click ( object sender , RoutedEventArgs e )
207
+ {
208
+ if ( RightClickedItem . Path . Equals ( AppSettings . RecycleBinPath , StringComparison . OrdinalIgnoreCase ) )
209
+ {
210
+ AppSettings . PinRecycleBinToSideBar = false ;
211
+ }
212
+ else if ( RightClickedItem . Section == SectionType . Favorites )
213
+ {
214
+ App . SidebarPinnedController . Model . RemoveItem ( RightClickedItem . Path . ToString ( ) ) ;
215
+ }
216
+ }
217
+
204
218
private void Sidebar_ItemInvoked ( Microsoft . UI . Xaml . Controls . NavigationView sender , Microsoft . UI . Xaml . Controls . NavigationViewItemInvokedEventArgs args )
205
219
{
206
220
if ( args . InvokedItem == null || args . InvokedItemContainer == null )
@@ -245,8 +259,8 @@ private void NavigationViewLocationItem_RightTapped(object sender, RightTappedRo
245
259
}
246
260
}
247
261
262
+ RightClickedItem = item ;
248
263
SideBarItemContextFlyout . ShowAt ( sidebarItem , e . GetPosition ( sidebarItem ) ) ;
249
- App . RightClickedItem = item ;
250
264
}
251
265
252
266
e . Handled = true ;
@@ -264,7 +278,7 @@ private void NavigationViewDriveItem_RightTapped(object sender, RightTappedRoute
264
278
265
279
SideBarItemContextFlyout . ShowAt ( sidebarItem , e . GetPosition ( sidebarItem ) ) ;
266
280
267
- App . RightClickedItem = item ;
281
+ RightClickedItem = item ;
268
282
269
283
e . Handled = true ;
270
284
}
@@ -281,19 +295,19 @@ private void NavigationViewWSLItem_RightTapped(object sender, RightTappedRoutedE
281
295
282
296
SideBarItemContextFlyout . ShowAt ( sidebarItem , e . GetPosition ( sidebarItem ) ) ;
283
297
284
- App . RightClickedItem = item ;
298
+ RightClickedItem = item ;
285
299
286
300
e . Handled = true ;
287
301
}
288
302
289
303
private void OpenInNewTab_Click ( object sender , RoutedEventArgs e )
290
304
{
291
- Interaction . OpenPathInNewTab ( App . RightClickedItem . Path ) ;
305
+ Interaction . OpenPathInNewTab ( RightClickedItem . Path ) ;
292
306
}
293
307
294
308
private async void OpenInNewWindow_Click ( object sender , RoutedEventArgs e )
295
309
{
296
- await Interaction . OpenPathInNewWindowAsync ( App . RightClickedItem . Path ) ;
310
+ await Interaction . OpenPathInNewWindowAsync ( RightClickedItem . Path ) ;
297
311
}
298
312
299
313
private void NavigationViewItem_DragStarting ( UIElement sender , DragStartingEventArgs args )
@@ -555,7 +569,7 @@ private void SettingsButton_Tapped(object sender, TappedRoutedEventArgs e)
555
569
556
570
private async void EjectDevice_Click ( object sender , RoutedEventArgs e )
557
571
{
558
- await DeviceHelpers . EjectDeviceAsync ( App . RightClickedItem . Path ) ;
572
+ await DeviceHelpers . EjectDeviceAsync ( RightClickedItem . Path ) ;
559
573
}
560
574
561
575
private void SidebarNavView_Loaded ( object sender , RoutedEventArgs e )
0 commit comments