Skip to content

Commit d0491a1

Browse files
authored
Set focus on file list when changing folder (#2636)
1 parent cec9096 commit d0491a1

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

Files/BaseLayout.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ public BaseLayout()
151151
}
152152
}
153153

154+
public abstract void FocusFileList();
155+
154156
public abstract void SelectAllItems();
155157

156158
public virtual void InvertSelection()
@@ -348,6 +350,8 @@ protected override async void OnNavigatedTo(NavigationEventArgs eventArgs)
348350

349351
ParentShellPageInstance.InstanceViewModel.IsPageTypeNotHome = true; // show controls that were hidden on the home page
350352
ParentShellPageInstance.Clipboard_ContentChanged(null, null);
353+
354+
FocusFileList(); // Set focus on layout specific file list control
351355
}
352356

353357
protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)

Files/Views/LayoutModes/GenericFileBrowser.xaml.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,11 @@ public override void ScrollIntoView(ListedItem item)
175175
AllView.ScrollIntoView(item, null);
176176
}
177177

178+
public override void FocusFileList()
179+
{
180+
AllView.Focus(FocusState.Programmatic);
181+
}
182+
178183
public override void FocusSelectedItems()
179184
{
180185
AllView.ScrollIntoView(AllView.ItemsSource.Cast<ListedItem>().Last(), null);

Files/Views/LayoutModes/GridViewBrowser.xaml.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ private async void SelectionRectangle_SelectionEnded(object sender, EventArgs e)
3838
FileList.Focus(FocusState.Programmatic);
3939
}
4040

41+
public override void FocusFileList()
42+
{
43+
FileList.Focus(FocusState.Programmatic);
44+
}
45+
4146
private void AppSettings_LayoutModeChangeRequested(object sender, EventArgs e)
4247
{
4348
SetItemTemplate(); // Set ItemTemplate

0 commit comments

Comments
 (0)