Skip to content

Commit 91e7e7a

Browse files
authored
Code Quality: Fixed an issue where suggestions in Path mode don't update when switching tabs (#17263)
1 parent 3c162d2 commit 91e7e7a

File tree

3 files changed

+25
-10
lines changed

3 files changed

+25
-10
lines changed

src/Files.App.Controls/Omnibar/Omnibar.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,12 @@ internal protected bool TryToggleIsSuggestionsPopupOpen(bool wantToOpen)
219219
return false;
220220
}
221221

222+
if (CurrentSelectedMode is not null)
223+
{
224+
_textBoxSuggestionsListView.ItemTemplate = CurrentSelectedMode.ItemTemplate;
225+
_textBoxSuggestionsListView.ItemsSource = CurrentSelectedMode.ItemsSource;
226+
}
227+
222228
_textBoxSuggestionsPopup.IsOpen = wantToOpen;
223229

224230
GlobalHelper.WriteDebugStringForOmnibar("The suggestions pop-up is open.");

src/Files.App.Controls/Omnibar/OmnibarMode.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,13 @@ protected override void OnApplyTemplate()
3535

3636
_modeButton = GetTemplateChild(TemplatePartName_ModeButton) as Button
3737
?? throw new MissingFieldException($"Could not find {TemplatePartName_ModeButton} in the given {nameof(OmnibarMode)}'s style.");
38-
38+
39+
RegisterPropertyChangedCallback(ItemsSourceProperty, (d, dp) =>
40+
{
41+
if (_ownerRef is not null && _ownerRef.TryGetTarget(out var owner))
42+
owner.TryToggleIsSuggestionsPopupOpen(true);
43+
});
44+
3945
Loaded += OmnibarMode_Loaded;
4046
_modeButton.PointerEntered += ModeButton_PointerEntered;
4147
_modeButton.PointerPressed += ModeButton_PointerPressed;

src/Files.App/UserControls/NavigationToolbar.xaml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -407,26 +407,29 @@
407407
<DataTemplate x:DataType="dataitems:NavigationBarSuggestionItem">
408408
<Grid Padding="0,0,4,0" ColumnSpacing="12">
409409
<Grid.ColumnDefinitions>
410-
<ColumnDefinition Width="16" />
410+
<!--<ColumnDefinition Width="Auto" />-->
411411
<ColumnDefinition Width="*" />
412412
<ColumnDefinition Width="Auto" />
413413
</Grid.ColumnDefinitions>
414414

415-
<Grid Grid.Column="0">
415+
<!--<Grid
416+
Grid.Column="0"
417+
Width="16"
418+
Height="16">
416419
<Viewbox
417420
Width="16"
418421
Height="16"
419-
Visibility="{x:Bind Glyph, Converter={StaticResource NullToVisibilityCollapsedConverter}}">
420-
<FontIcon Foreground="{ThemeResource App.Theme.IconBaseBrush}" Glyph="{x:Bind Glyph}" />
422+
Visibility="{x:Bind Glyph, Converter={StaticResource NullToVisibilityCollapsedConverter}, Mode=OneWay}">
423+
<FontIcon Foreground="{ThemeResource App.Theme.IconBaseBrush}" Glyph="{x:Bind Glyph, Mode=OneWay}" />
421424
</Viewbox>
422-
<controls:ThemedIcon Style="{x:Bind ThemedIconStyle}" Visibility="{x:Bind ThemedIconStyle, Converter={StaticResource NullToVisibilityCollapsedConverter}}" />
425+
<controls:ThemedIcon Style="{x:Bind ThemedIconStyle, Mode=OneWay}" Visibility="{x:Bind ThemedIconStyle, Converter={StaticResource NullToVisibilityCollapsedConverter}, Mode=OneWay}" />
423426
<Image Source="{x:Bind ActionIconSource, Mode=OneWay}" />
424-
</Grid>
427+
</Grid>-->
425428

426429
<!-- Primary Title -->
427430
<TextBlock
428431
x:Name="PrimaryDisplayBlock"
429-
Grid.Column="1"
432+
Grid.Column="0"
430433
VerticalAlignment="Center"
431434
Foreground="{ThemeResource TextFillColorPrimaryBrush}"
432435
TextTrimming="CharacterEllipsis"
@@ -437,9 +440,9 @@
437440
<!-- Keyboard Shortcuts -->
438441
<keyboard:KeyboardShortcut
439442
x:Name="RightAlignedKeyboardShortcut"
440-
Grid.Column="2"
443+
Grid.Column="1"
441444
VerticalAlignment="Center"
442-
HotKeys="{x:Bind HotKeys}" />
445+
HotKeys="{x:Bind HotKeys, Mode=OneWay}" />
443446
</Grid>
444447
</DataTemplate>
445448
</controls:OmnibarMode.ItemTemplate>

0 commit comments

Comments
 (0)