Skip to content

Commit 854be20

Browse files
committed
things
1 parent 46fccfe commit 854be20

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

src/Files.App/UserControls/PathBreadcrumb.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@
134134
IsItemClickEnabled="True"
135135
ItemTemplateSelector="{StaticResource PathBreadcrumbItemSelector}"
136136
ItemsSource="{x:Bind ViewModel.PathComponents, Mode=OneWay}"
137-
KeyDown="PathBoxItem_KeyDown"
137+
PreviewKeyDown="PathBoxItem_PreviewKeyDown"
138138
ScrollViewer.HorizontalScrollBarVisibility="Hidden"
139139
ScrollViewer.HorizontalScrollMode="Enabled"
140140
ScrollViewer.VerticalScrollBarVisibility="Disabled"

src/Files.App/UserControls/PathBreadcrumb.xaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ private void PathBoxItem_PointerPressed(object sender, PointerRoutedEventArgs e)
5050
ViewModel.PathBoxItem_PointerPressed(sender, e);
5151
}
5252

53-
private void PathBoxItem_KeyDown(object sender, KeyRoutedEventArgs e)
53+
private void PathBoxItem_PreviewKeyDown(object sender, KeyRoutedEventArgs e)
5454
{
55-
ViewModel.PathBoxItem_KeyDown(sender, e);
55+
ViewModel.PathBoxItem_PreviewKeyDown(sender, e);
5656
}
5757
}
5858
}

src/Files.App/ViewModels/UserControls/AddressToolbarViewModel.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,14 +537,25 @@ await MainWindow.Instance.DispatcherQueue.EnqueueOrInvokeAsync(async () =>
537537
});
538538
}
539539

540-
public void PathBoxItem_KeyDown(object sender, KeyRoutedEventArgs e)
540+
public void PathBoxItem_PreviewKeyDown(object sender, KeyRoutedEventArgs e)
541541
{
542542
if (e.Key == Windows.System.VirtualKey.Down)
543543
{
544544
var item = e.OriginalSource as ListViewItem;
545545
var button = item?.FindDescendant<Button>();
546546
button?.Flyout.ShowAt(button);
547547
e.Handled = true;
548+
} else if (e.Key == Windows.System.VirtualKey.Space || e.Key == Windows.System.VirtualKey.Enter)
549+
{
550+
var item = e.OriginalSource as ListViewItem;
551+
var path = (item?.Content as PathBoxItem)?.Path;
552+
if (path == null || path == PathControlDisplayText)
553+
return;
554+
ToolbarPathItemInvoked?.Invoke(this, new PathNavigationEventArgs()
555+
{
556+
ItemPath = path
557+
});
558+
e.Handled = true;
548559
}
549560
}
550561

0 commit comments

Comments
 (0)