@@ -86,6 +86,32 @@ private void ListView_DragItemsStarting(object sender, DragItemsStartingEventArg
8686 dataObjectProvider . SetDataObject ( ppDataObject ) ;
8787 }
8888
89+ private void ShelfItemsList_RightTapped ( object sender , Microsoft . UI . Xaml . Input . RightTappedRoutedEventArgs e )
90+ {
91+ if ( e . OriginalSource is not Microsoft . UI . Xaml . FrameworkElement widgetCardItem ||
92+ widgetCardItem . DataContext is not ShelfItem item ||
93+ item . Path is null )
94+ return ;
95+
96+ var menuFlyout = new MenuFlyout ( ) ;
97+
98+ menuFlyout . Items . Add ( new MenuFlyoutItem
99+ {
100+ Text = Strings . RemoveFromShelf . GetLocalizedResource ( ) ,
101+ Icon = new FontIcon { Glyph = "\uE738 " } ,
102+ Command = new RelayCommand ( item . Remove )
103+ } ) ;
104+
105+ menuFlyout . ShowAt ( widgetCardItem ) ;
106+ e . Handled = true ;
107+ }
108+
109+ private void ShelfItemsList_GotFocus ( object sender , RoutedEventArgs e )
110+ {
111+ if ( ItemFocusedCommand is not null )
112+ ItemFocusedCommand . Execute ( null ) ;
113+ }
114+
89115 public ObservableCollection < ShelfItem > ? ItemsSource
90116 {
91117 get => ( ObservableCollection < ShelfItem > ? ) GetValue ( ItemsSourceProperty ) ;
@@ -101,5 +127,14 @@ public ICommand? ClearCommand
101127 }
102128 public static readonly DependencyProperty ClearCommandProperty =
103129 DependencyProperty . Register ( nameof ( ClearCommand ) , typeof ( ICommand ) , typeof ( ShelfPane ) , new PropertyMetadata ( null ) ) ;
130+
131+ public ICommand ? ItemFocusedCommand
132+ {
133+ get => ( ICommand ? ) GetValue ( ItemFocusedCommandProperty ) ;
134+ set => SetValue ( ItemFocusedCommandProperty , value ) ;
135+ }
136+ public static readonly DependencyProperty ItemFocusedCommandProperty =
137+ DependencyProperty . Register ( nameof ( ItemFocusedCommand ) , typeof ( ICommand ) , typeof ( ShelfPane ) , new PropertyMetadata ( null ) ) ;
138+
104139 }
105140}
0 commit comments