@@ -119,27 +119,27 @@ public bool IsPageMainPane
119119 }
120120 }
121121
122- public ICommand SelectAllContentPageItemsCommand { get ; private set ; }
122+ public ICommand SelectAllContentPageItemsCommand => new RelayCommand ( ( ) => SlimContentPage ? . SelectAllItems ( ) ) ;
123123
124- public ICommand InvertContentPageSelctionCommand { get ; private set ; }
124+ public ICommand InvertContentPageSelctionCommand => new RelayCommand ( ( ) => SlimContentPage ? . InvertSelection ( ) ) ;
125125
126- public ICommand ClearContentPageSelectionCommand { get ; private set ; }
126+ public ICommand ClearContentPageSelectionCommand => new RelayCommand ( ( ) => SlimContentPage ? . ClearSelection ( ) ) ;
127127
128- public ICommand PasteItemsFromClipboardCommand { get ; private set ; }
128+ public ICommand PasteItemsFromClipboardCommand => new RelayCommand ( async ( ) => await UIFilesystemHelpers . PasteItemAsync ( FilesystemViewModel . WorkingDirectory , this ) ) ;
129129
130- public ICommand CopyPathOfWorkingDirectoryCommand { get ; private set ; }
130+ public ICommand CopyPathOfWorkingDirectoryCommand => new RelayCommand ( CopyWorkingLocation ) ;
131131
132- public ICommand OpenNewWindowCommand { get ; private set ; }
132+ public ICommand OpenNewWindowCommand => new RelayCommand ( NavigationHelpers . LaunchNewWindow ) ;
133133
134- public ICommand OpenNewPaneCommand { get ; private set ; }
134+ public ICommand OpenNewPaneCommand => new RelayCommand ( ( ) => PaneHolder ? . OpenPathInNewPane ( "NewTab" . GetLocalized ( ) ) ) ;
135135
136- public ICommand OpenDirectoryInDefaultTerminalCommand { get ; private set ; }
136+ public ICommand OpenDirectoryInDefaultTerminalCommand => new RelayCommand ( ( ) => NavigationHelpers . OpenDirectoryInTerminal ( this . FilesystemViewModel . WorkingDirectory , this ) ) ;
137137
138- public ICommand AddNewTabToMultitaskingControlCommand { get ; private set ; }
138+ public ICommand AddNewTabToMultitaskingControlCommand => new RelayCommand ( async ( ) => await MainPageViewModel . AddNewTabByPathAsync ( typeof ( PaneHolderPage ) , "NewTab" . GetLocalized ( ) ) ) ;
139139
140- public ICommand CreateNewFileCommand { get ; private set ; }
140+ public ICommand CreateNewFileCommand => new RelayCommand ( ( ) => UIFilesystemHelpers . CreateFileFromDialogResultType ( AddItemType . File , null , this ) ) ;
141141
142- public ICommand CreateNewFolderCommand { get ; private set ; }
142+ public ICommand CreateNewFolderCommand => new RelayCommand ( ( ) => UIFilesystemHelpers . CreateFileFromDialogResultType ( AddItemType . Folder , null , this ) ) ;
143143
144144 public static readonly DependencyProperty IsPageMainPaneProperty =
145145 DependencyProperty . Register ( "IsPageMainPane" , typeof ( bool ) , typeof ( ModernShellPage ) , new PropertyMetadata ( true ) ) ;
@@ -212,25 +212,6 @@ public ModernShellPage()
212212 AppServiceConnectionHelper . ConnectionChanged += AppServiceConnectionHelper_ConnectionChanged ;
213213 }
214214
215- private void InitializeCommands ( )
216- {
217- if ( this . SlimContentPage != null )
218- {
219- SelectAllContentPageItemsCommand = new RelayCommand ( this . SlimContentPage . SelectAllItems ) ;
220- ClearContentPageSelectionCommand = new RelayCommand ( this . SlimContentPage . ClearSelection ) ;
221- InvertContentPageSelctionCommand = new RelayCommand ( this . SlimContentPage . InvertSelection ) ;
222- }
223- PasteItemsFromClipboardCommand = new RelayCommand ( async ( ) => await UIFilesystemHelpers . PasteItemAsync ( FilesystemViewModel . WorkingDirectory , this ) ) ;
224- CopyPathOfWorkingDirectoryCommand = new RelayCommand ( CopyWorkingLocation ) ;
225- OpenNewWindowCommand = new RelayCommand ( NavigationHelpers . LaunchNewWindow ) ;
226- OpenNewPaneCommand = new RelayCommand ( ( ) => PaneHolder ? . OpenPathInNewPane ( "NewTab" . GetLocalized ( ) ) ) ;
227- OpenDirectoryInDefaultTerminalCommand = new RelayCommand ( ( ) => NavigationHelpers . OpenDirectoryInTerminal ( this . FilesystemViewModel . WorkingDirectory , this ) ) ;
228- AddNewTabToMultitaskingControlCommand = new RelayCommand ( async ( ) => await MainPageViewModel . AddNewTabByPathAsync ( typeof ( PaneHolderPage ) , "NewTab" . GetLocalized ( ) ) ) ;
229-
230- CreateNewFileCommand = new RelayCommand ( ( ) => UIFilesystemHelpers . CreateFileFromDialogResultType ( AddItemType . File , null , this ) ) ;
231- CreateNewFolderCommand = new RelayCommand ( ( ) => UIFilesystemHelpers . CreateFileFromDialogResultType ( AddItemType . Folder , null , this ) ) ;
232- }
233-
234215 private void CopyWorkingLocation ( )
235216 {
236217 try
@@ -900,7 +881,6 @@ private void ViewModel_WorkingDirectoryModified(object sender, WorkingDirectoryM
900881 private async void ItemDisplayFrame_Navigated ( object sender , NavigationEventArgs e )
901882 {
902883 ContentPage = await GetContentOrNullAsync ( ) ;
903- InitializeCommands ( ) ;
904884 NavigationToolbar . ClearSearchBoxQueryText ( true ) ;
905885 if ( ItemDisplayFrame . CurrentSourcePageType == typeof ( GenericFileBrowser )
906886 || ItemDisplayFrame . CurrentSourcePageType == typeof ( GridViewBrowser ) )
0 commit comments