Skip to content

Commit 58a80d0

Browse files
Feature: Start a search when clicking tags in the details layout (#11225)
1 parent 61055f9 commit 58a80d0

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/Files.App/Views/LayoutModes/DetailsLayoutBrowser.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,7 @@
699699
CornerRadius="12"
700700
Orientation="Horizontal"
701701
Spacing="8"
702+
Tapped="TagItem_Tapped"
702703
ToolTipService.ToolTip="{x:Bind Name, Mode=OneWay}">
703704
<FontIcon
704705
FontSize="12"

src/Files.App/Views/LayoutModes/DetailsLayoutBrowser.xaml.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ namespace Files.App.Views.LayoutModes
2929
{
3030
public sealed partial class DetailsLayoutBrowser : StandardViewBase
3131
{
32+
private const int TAG_TEXT_BLOCK = 1;
33+
3234
private uint currentIconSize;
3335

3436
private InputCursor arrowCursor = InputCursor.CreateFromCoreCursor(new CoreCursor(CoreCursorType.Arrow, 0));
@@ -715,5 +717,14 @@ private void SetCheckboxSelectionState(object item, ListViewItem? lviContainer =
715717
checkbox.IsChecked = FileList.SelectedItems.Contains(item);
716718
}
717719
}
720+
721+
private void TagItem_Tapped(object sender, TappedRoutedEventArgs e)
722+
{
723+
var tagName = ((sender as StackPanel)?.Children[TAG_TEXT_BLOCK] as TextBlock)?.Text;
724+
if (tagName is null)
725+
return;
726+
727+
ParentShellPageInstance.SubmitSearch($"tag:{tagName}", false);
728+
}
718729
}
719730
}

0 commit comments

Comments
 (0)