Skip to content

Commit 6816eeb

Browse files
committed
Add support of populating chevron drop down
1 parent 8e1b9a2 commit 6816eeb

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

Diff for: src/Files.App/UserControls/NavigationToolbar.xaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -352,9 +352,9 @@
352352
Text="{x:Bind ViewModel.OmnibarPathModeText, Mode=OneWay}">
353353
<controls:OmnibarMode.ContentOnInactive>
354354
<controls:BreadcrumbBar
355-
x:Name="NewBreadcrumbBar"
356-
ItemDropDownFlyoutClosed="NewBreadcrumbBar_ItemDropDownFlyoutClosed"
357-
ItemDropDownFlyoutOpening="NewBreadcrumbBar_ItemDropDownFlyoutOpening"
355+
x:Name="BreadcrumbBar"
356+
ItemDropDownFlyoutClosed="BreadcrumbBar_ItemDropDownFlyoutClosed"
357+
ItemDropDownFlyoutOpening="BreadcrumbBar_ItemDropDownFlyoutOpening"
358358
ItemsSource="{x:Bind ViewModel.PathComponents, Mode=OneWay}">
359359
<controls:BreadcrumbBar.RootItem>
360360
<Image

Diff for: src/Files.App/UserControls/NavigationToolbar.xaml.cs

+5-4
Original file line numberDiff line numberDiff line change
@@ -134,14 +134,15 @@ private void ClickablePath_GettingFocus(UIElement sender, GettingFocusEventArgs
134134
}
135135
#endregion
136136

137-
private void NewBreadcrumbBar_ItemDropDownFlyoutOpening(object sender, Controls.BreadcrumbBarItemDropDownFlyoutEventArgs e)
137+
private async void BreadcrumbBar_ItemDropDownFlyoutOpening(object sender, Controls.BreadcrumbBarItemDropDownFlyoutEventArgs e)
138138
{
139-
139+
await ViewModel.SetPathBoxDropDownFlyoutAsync(e.Flyout, ViewModel.PathComponents[e.Index]);
140140
}
141141

142-
private void NewBreadcrumbBar_ItemDropDownFlyoutClosed(object sender, Controls.BreadcrumbBarItemDropDownFlyoutEventArgs e)
142+
private void BreadcrumbBar_ItemDropDownFlyoutClosed(object sender, Controls.BreadcrumbBarItemDropDownFlyoutEventArgs e)
143143
{
144-
144+
// Clear the flyout items to save memory
145+
e.Flyout.Items.Clear();
145146
}
146147

147148
private void Button_AccessKeyInvoked(UIElement sender, AccessKeyInvokedEventArgs args)

Diff for: src/Files.App/ViewModels/UserControls/NavigationToolbarViewModel.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -709,12 +709,12 @@ public void SearchRegion_LostFocus(object sender, RoutedEventArgs e)
709709
private void SearchRegion_Escaped(object? sender, ISearchBoxViewModel _SearchBox)
710710
=> CloseSearchBox(true);
711711

712-
public async Task SetPathBoxDropDownFlyoutAsync(MenuFlyout flyout, PathBoxItem pathItem, IShellPage shellPage)
712+
public async Task SetPathBoxDropDownFlyoutAsync(MenuFlyout flyout, PathBoxItem pathItem)
713713
{
714714
var nextPathItemTitle = PathComponents[PathComponents.IndexOf(pathItem) + 1].Title;
715715
IList<StorageFolderWithPath>? childFolders = null;
716716

717-
StorageFolderWithPath folder = await shellPage.ShellViewModel.GetFolderWithPathFromPathAsync(pathItem.Path);
717+
StorageFolderWithPath folder = await ContentPageContext.ShellPage.ShellViewModel.GetFolderWithPathFromPathAsync(pathItem.Path);
718718
if (folder is not null)
719719
childFolders = (await FilesystemTasks.Wrap(() => folder.GetFoldersWithPathAsync(string.Empty))).Result;
720720

@@ -755,7 +755,7 @@ public async Task SetPathBoxDropDownFlyoutAsync(MenuFlyout flyout, PathBoxItem p
755755
flyoutItem.Click += (sender, args) =>
756756
{
757757
// Navigate to the directory
758-
shellPage.NavigateToPath(childFolder.Path);
758+
ContentPageContext.ShellPage.NavigateToPath(childFolder.Path);
759759
};
760760
}
761761

Diff for: src/Files.App/Views/Shells/BaseShellPage.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -422,15 +422,15 @@ protected async void ShellPage_AddressBarTextEntered(object sender, AddressBarTe
422422

423423
protected async void ShellPage_ToolbarPathItemLoaded(object sender, ToolbarPathItemLoadedEventArgs e)
424424
{
425-
await ToolbarViewModel.SetPathBoxDropDownFlyoutAsync(e.OpenedFlyout, e.Item, this);
425+
await ToolbarViewModel.SetPathBoxDropDownFlyoutAsync(e.OpenedFlyout, e.Item);
426426
}
427427

428428
protected async void ShellPage_ToolbarFlyoutOpening(object sender, ToolbarFlyoutOpeningEventArgs e)
429429
{
430430
var pathBoxItem = ((Button)e.OpeningFlyout.Target).DataContext as PathBoxItem;
431431

432432
if (pathBoxItem is not null)
433-
await ToolbarViewModel.SetPathBoxDropDownFlyoutAsync(e.OpeningFlyout, pathBoxItem, this);
433+
await ToolbarViewModel.SetPathBoxDropDownFlyoutAsync(e.OpeningFlyout, pathBoxItem);
434434
}
435435

436436
protected async void NavigationToolbar_QuerySubmitted(object sender, ToolbarQuerySubmittedEventArgs e)

0 commit comments

Comments
 (0)