Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Improved touch target for breadcrumbs #14003

Merged
merged 4 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 18 additions & 21 deletions src/Files.App/UserControls/PathBreadcrumb.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,25 +83,16 @@
</i:Interaction.Behaviors>
</TextBlock>

<!-- Chevron -->
<FontIcon
x:Name="PathSeaparatorIcon"
DataContextChanged="PathItemSeparator_DataContextChanged"
FontSize="12"
Glyph="&#xE76C;"
Loaded="PathItemSeparator_Loaded">
<i:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="PointerEntered">
<core:ChangePropertyAction PropertyName="Opacity" Value="0.7" />
</core:EventTriggerBehavior>
<core:EventTriggerBehavior EventName="PointerExited">
<core:ChangePropertyAction PropertyName="Opacity" Value="1.0" />
</core:EventTriggerBehavior>
</i:Interaction.Behaviors>

<!-- Child Items -->
<FontIcon.ContextFlyout>
<Button
Padding="4,6,4,6"
AutomationProperties.AccessibilityView="Raw"
Background="Transparent"
BorderBrush="Transparent"
CornerRadius="0,4,4,0"
DataContextChanged="PathItemSeparator_DataContextChanged">
<Button.Flyout>
<MenuFlyout
x:Name="ExpandMenuFlyout"
Opened="PathBoxItemFlyout_Opened"
Placement="BottomEdgeAlignedLeft"
ScrollViewer.VerticalScrollBarVisibility="Auto"
Expand All @@ -112,9 +103,15 @@
</Style>
</MenuFlyout.MenuFlyoutPresenterStyle>
</MenuFlyout>
</FontIcon.ContextFlyout>

</FontIcon>
</Button.Flyout>

<!-- Chevron -->
<FontIcon
x:Name="ExpandMenuFontIcon"
AutomationProperties.AccessibilityView="Raw"
FontSize="12"
Glyph="&#xE76C;" />
</Button>

</StackPanel>
</DataTemplate>
Expand Down
21 changes: 0 additions & 21 deletions src/Files.App/UserControls/PathBreadcrumb.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,5 @@ private void PathBoxItem_PointerPressed(object sender, PointerRoutedEventArgs e)
{
ViewModel.PathBoxItem_PointerPressed(sender, e);
}

private void PathItemSeparator_Loaded(object sender, RoutedEventArgs e)
{
if (sender is not FontIcon pathSeparatorIcon)
return;

pathSeparatorIcon.Tapped += (s, e) =>
{
pathSeparatorIcon.ContextFlyout.ShowAt(pathSeparatorIcon);
};

pathSeparatorIcon.ContextFlyout.Opened += (s, e) =>
{
pathSeparatorIcon.Glyph = "\uE70D";
};

pathSeparatorIcon.ContextFlyout.Closed += (s, e) =>
{
pathSeparatorIcon.Glyph = "\uE76C";
};
}
}
}
5 changes: 4 additions & 1 deletion src/Files.App/Views/Shells/BaseShellPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,10 @@ protected async void ShellPage_ToolbarPathItemLoaded(object sender, ToolbarPathI

protected async void ShellPage_ToolbarFlyoutOpened(object sender, ToolbarFlyoutOpenedEventArgs e)
{
await ToolbarViewModel.SetPathBoxDropDownFlyoutAsync(e.OpenedFlyout, (e.OpenedFlyout.Target as FontIcon).DataContext as PathBoxItem, this);
var pathBoxItem = ((Button)e.OpenedFlyout.Target).DataContext as PathBoxItem;

if (pathBoxItem is not null)
await ToolbarViewModel.SetPathBoxDropDownFlyoutAsync(e.OpenedFlyout, pathBoxItem, this);
}

protected async void NavigationToolbar_QuerySubmitted(object sender, ToolbarQuerySubmittedEventArgs e)
Expand Down