Skip to content

Commit bf16dca

Browse files
Fix: Fixed issue where the 'layout' icon didn't match the select layout (#17436)
Co-authored-by: Yair <[email protected]>
1 parent 66fa8a1 commit bf16dca

File tree

3 files changed

+38
-6
lines changed

3 files changed

+38
-6
lines changed

src/Files.App.Controls/ThemedIcon/ThemedIcon.Properties.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,5 +97,22 @@ partial void OnToggleBehaviorChanged(ToggleBehaviors newValue)
9797
{
9898
UpdateVisualStates();
9999
}
100+
101+
private void OnStylePropertyChanged(DependencyObject sender, DependencyProperty dp)
102+
{
103+
if (dp != StyleProperty)
104+
return;
105+
106+
DispatcherQueue.TryEnqueue(() =>
107+
{
108+
GetTemplateParts();
109+
OnFilledIconChanged();
110+
OnOutlineIconChanged();
111+
OnLayeredIconChanged();
112+
OnIconTypeChanged();
113+
OnIconColorTypeChanged();
114+
OnIconSizeChanged();
115+
});
116+
}
100117
}
101118
}

src/Files.App.Controls/ThemedIcon/ThemedIcon.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,24 @@ public partial class ThemedIcon : Control
1717
private Viewbox? _layeredViewBox;
1818
private Canvas? _layeredCanvas;
1919

20+
private long _stylePropertyChangedToken;
21+
2022
public ThemedIcon()
2123
{
2224
DefaultStyleKey = typeof(ThemedIcon);
25+
_stylePropertyChangedToken = RegisterPropertyChangedCallback(
26+
StyleProperty,
27+
OnStylePropertyChanged
28+
);
29+
30+
Unloaded += OnUnloaded;
31+
}
32+
33+
private void OnUnloaded(object sender, RoutedEventArgs e)
34+
{
35+
UnregisterPropertyChangedCallback(StyleProperty, _stylePropertyChangedToken);
36+
IsEnabledChanged -= OnIsEnabledChanged;
37+
Unloaded -= OnUnloaded;
2338
}
2439

2540
protected override void OnApplyTemplate()
@@ -252,4 +267,4 @@ private void OnIconSizeChanged()
252267
Height = Width = IconSize;
253268
}
254269
}
255-
}
270+
}

src/Files.App/UserControls/NavigationToolbar.xaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -297,12 +297,12 @@
297297
<DataTemplate x:DataType="dataitems:NavigationBarSuggestionItem">
298298
<Grid Padding="0,0,4,0" ColumnSpacing="12">
299299
<Grid.ColumnDefinitions>
300-
<!--<ColumnDefinition Width="Auto" />-->
300+
<ColumnDefinition Width="Auto" />
301301
<ColumnDefinition Width="*" />
302302
<ColumnDefinition Width="Auto" />
303303
</Grid.ColumnDefinitions>
304304

305-
<!--<Grid
305+
<Grid
306306
Grid.Column="0"
307307
Width="16"
308308
Height="16">
@@ -314,12 +314,12 @@
314314
</Viewbox>
315315
<controls:ThemedIcon Style="{x:Bind ThemedIconStyle, Mode=OneWay}" Visibility="{x:Bind ThemedIconStyle, Converter={StaticResource NullToVisibilityCollapsedConverter}, Mode=OneWay}" />
316316
<Image Source="{x:Bind ActionIconSource, Mode=OneWay}" />
317-
</Grid>-->
317+
</Grid>
318318

319319
<!-- Primary Title -->
320320
<TextBlock
321321
x:Name="PrimaryDisplayBlock"
322-
Grid.Column="0"
322+
Grid.Column="1"
323323
VerticalAlignment="Center"
324324
Foreground="{ThemeResource TextFillColorPrimaryBrush}"
325325
TextTrimming="CharacterEllipsis"
@@ -330,7 +330,7 @@
330330
<!-- Keyboard Shortcuts -->
331331
<keyboard:KeyboardShortcut
332332
x:Name="RightAlignedKeyboardShortcut"
333-
Grid.Column="1"
333+
Grid.Column="2"
334334
VerticalAlignment="Center"
335335
HotKeys="{x:Bind HotKeys, Mode=OneWay}" />
336336
</Grid>

0 commit comments

Comments
 (0)