Skip to content

Commit f8c728b

Browse files
el-evyaira2
authored andcommitted
things
1 parent 04c6fd7 commit f8c728b

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
@@ -136,7 +136,7 @@
136136
IsItemClickEnabled="True"
137137
ItemTemplateSelector="{StaticResource PathBreadcrumbItemSelector}"
138138
ItemsSource="{x:Bind ViewModel.PathComponents, Mode=OneWay}"
139-
KeyDown="PathBoxItem_KeyDown"
139+
PreviewKeyDown="PathBoxItem_PreviewKeyDown"
140140
ScrollViewer.HorizontalScrollBarVisibility="Hidden"
141141
ScrollViewer.HorizontalScrollMode="Enabled"
142142
ScrollViewer.VerticalScrollBarVisibility="Disabled"

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ private void PathBoxItem_PointerPressed(object sender, PointerRoutedEventArgs e)
5555
ViewModel.PathBoxItem_PointerPressed(sender, e);
5656
}
5757

58-
private void PathBoxItem_KeyDown(object sender, KeyRoutedEventArgs e)
58+
private void PathBoxItem_PreviewKeyDown(object sender, KeyRoutedEventArgs e)
5959
{
60-
ViewModel.PathBoxItem_KeyDown(sender, e);
60+
ViewModel.PathBoxItem_PreviewKeyDown(sender, e);
6161
}
6262
}
6363
}

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

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

528-
public void PathBoxItem_KeyDown(object sender, KeyRoutedEventArgs e)
528+
public void PathBoxItem_PreviewKeyDown(object sender, KeyRoutedEventArgs e)
529529
{
530530
if (e.Key == Windows.System.VirtualKey.Down)
531531
{
532532
var item = e.OriginalSource as ListViewItem;
533533
var button = item?.FindDescendant<Button>();
534534
button?.Flyout.ShowAt(button);
535535
e.Handled = true;
536+
} else if (e.Key == Windows.System.VirtualKey.Space || e.Key == Windows.System.VirtualKey.Enter)
537+
{
538+
var item = e.OriginalSource as ListViewItem;
539+
var path = (item?.Content as PathBoxItem)?.Path;
540+
if (path == null || path == PathControlDisplayText)
541+
return;
542+
ToolbarPathItemInvoked?.Invoke(this, new PathNavigationEventArgs()
543+
{
544+
ItemPath = path
545+
});
546+
e.Handled = true;
536547
}
537548
}
538549

0 commit comments

Comments
 (0)