Skip to content

Commit 38701a9

Browse files
authored
Code Quality: Simplified binding statements (files-community#16930)
1 parent 8605e2b commit 38701a9

File tree

3 files changed

+36
-39
lines changed

3 files changed

+36
-39
lines changed

src/Files.App/UserControls/NavigationToolbar.xaml

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -267,13 +267,13 @@
267267
x:Name="Back"
268268
AccessKey="B"
269269
AccessKeyInvoked="Button_AccessKeyInvoked"
270-
AutomationProperties.FullDescription="{x:Bind ViewModel.Commands.NavigateBack.Description, Mode=OneWay}"
271-
AutomationProperties.Name="{x:Bind ViewModel.Commands.NavigateBack.Label, Mode=OneWay}"
272-
Command="{x:Bind ViewModel.Commands.NavigateBack, Mode=OneWay}"
273-
IsEnabled="{x:Bind ViewModel.Commands.NavigateBack.IsExecutable, Mode=OneWay}"
270+
AutomationProperties.FullDescription="{x:Bind Commands.NavigateBack.Description, Mode=OneWay}"
271+
AutomationProperties.Name="{x:Bind Commands.NavigateBack.Label, Mode=OneWay}"
272+
Command="{x:Bind Commands.NavigateBack, Mode=OneWay}"
273+
IsEnabled="{x:Bind Commands.NavigateBack.IsExecutable, Mode=OneWay}"
274274
Style="{StaticResource AddressToolbarButtonStyle}"
275-
ToolTipService.ToolTip="{x:Bind ViewModel.Commands.NavigateBack.LabelWithHotKey, Mode=OneWay}">
276-
<FontIcon FontSize="14" Glyph="{x:Bind ViewModel.Commands.NavigateBack.Glyph.BaseGlyph, Mode=OneWay}" />
275+
ToolTipService.ToolTip="{x:Bind Commands.NavigateBack.LabelWithHotKey, Mode=OneWay}">
276+
<FontIcon FontSize="14" Glyph="{x:Bind Commands.NavigateBack.Glyph.BaseGlyph, Mode=OneTime}" />
277277
<Button.ContextFlyout>
278278
<MenuFlyout
279279
x:Name="BackHistoryFlyout"
@@ -297,13 +297,13 @@
297297
x:Name="Forward"
298298
AccessKey="F"
299299
AccessKeyInvoked="Button_AccessKeyInvoked"
300-
AutomationProperties.FullDescription="{x:Bind ViewModel.Commands.NavigateForward.Description, Mode=OneWay}"
301-
AutomationProperties.Name="{x:Bind ViewModel.Commands.NavigateForward.Label, Mode=OneWay}"
302-
Command="{x:Bind ViewModel.Commands.NavigateForward, Mode=OneWay}"
303-
IsEnabled="{x:Bind ViewModel.Commands.NavigateForward.IsExecutable, Mode=OneWay}"
300+
AutomationProperties.FullDescription="{x:Bind Commands.NavigateForward.Description, Mode=OneWay}"
301+
AutomationProperties.Name="{x:Bind Commands.NavigateForward.Label, Mode=OneWay}"
302+
Command="{x:Bind Commands.NavigateForward, Mode=OneWay}"
303+
IsEnabled="{x:Bind Commands.NavigateForward.IsExecutable, Mode=OneWay}"
304304
Style="{StaticResource AddressToolbarButtonStyle}"
305-
ToolTipService.ToolTip="{x:Bind ViewModel.Commands.NavigateForward.LabelWithHotKey, Mode=OneWay}">
306-
<FontIcon FontSize="14" Glyph="{x:Bind ViewModel.Commands.NavigateForward.Glyph.BaseGlyph, Mode=OneWay}" />
305+
ToolTipService.ToolTip="{x:Bind Commands.NavigateForward.LabelWithHotKey, Mode=OneWay}">
306+
<FontIcon FontSize="14" Glyph="{x:Bind Commands.NavigateForward.Glyph.BaseGlyph, Mode=OneTime}" />
307307
<Button.ContextFlyout>
308308
<MenuFlyout
309309
x:Name="ForwardHistoryFlyout"
@@ -327,38 +327,38 @@
327327
x:Name="Up"
328328
AccessKey="U"
329329
AccessKeyInvoked="Button_AccessKeyInvoked"
330-
AutomationProperties.FullDescription="{x:Bind ViewModel.Commands.NavigateUp.Description, Mode=OneWay}"
331-
AutomationProperties.Name="{x:Bind ViewModel.Commands.NavigateUp.Label, Mode=OneWay}"
332-
Command="{x:Bind ViewModel.Commands.NavigateUp, Mode=OneWay}"
333-
IsEnabled="{x:Bind ViewModel.Commands.NavigateUp.IsExecutable, Mode=OneWay}"
330+
AutomationProperties.FullDescription="{x:Bind Commands.NavigateUp.Description, Mode=OneWay}"
331+
AutomationProperties.Name="{x:Bind Commands.NavigateUp.Label, Mode=OneWay}"
332+
Command="{x:Bind Commands.NavigateUp, Mode=OneWay}"
333+
IsEnabled="{x:Bind Commands.NavigateUp.IsExecutable, Mode=OneWay}"
334334
Style="{StaticResource AddressToolbarButtonStyle}"
335-
ToolTipService.ToolTip="{x:Bind ViewModel.Commands.NavigateUp.LabelWithHotKey, Mode=OneWay}">
336-
<FontIcon FontSize="14" Glyph="{x:Bind ViewModel.Commands.NavigateUp.Glyph.BaseGlyph, Mode=OneWay}" />
335+
ToolTipService.ToolTip="{x:Bind Commands.NavigateUp.LabelWithHotKey, Mode=OneWay}">
336+
<FontIcon FontSize="14" Glyph="{x:Bind Commands.NavigateUp.Glyph.BaseGlyph, Mode=OneTime}" />
337337
</Button>
338338

339339
<Button
340340
x:Name="Refresh"
341341
AccessKey="R"
342342
AccessKeyInvoked="Button_AccessKeyInvoked"
343-
AutomationProperties.Name="{x:Bind Commands.RefreshItems.Label}"
343+
AutomationProperties.Name="{x:Bind Commands.RefreshItems.Label, Mode=OneWay}"
344344
Command="{x:Bind Commands.RefreshItems, Mode=OneWay}"
345345
IsEnabled="{x:Bind Commands.RefreshItems.IsExecutable, Mode=OneWay}"
346346
Style="{StaticResource AddressToolbarButtonStyle}"
347347
ToolTipService.ToolTip="{x:Bind Commands.RefreshItems.LabelWithHotKey, Mode=OneWay}">
348-
<FontIcon FontSize="14" Glyph="{x:Bind Commands.RefreshItems.Glyph.BaseGlyph}" />
348+
<FontIcon FontSize="14" Glyph="{x:Bind Commands.RefreshItems.Glyph.BaseGlyph, Mode=OneTime}" />
349349
</Button>
350350

351351
<Button
352352
x:Name="HomeButton"
353353
x:Load="{x:Bind ViewModel.ShowHomeButton, Mode=OneWay}"
354354
AccessKey="H"
355355
AccessKeyInvoked="Button_AccessKeyInvoked"
356-
AutomationProperties.Name="{x:Bind Commands.NavigateHome.Label}"
356+
AutomationProperties.Name="{x:Bind Commands.NavigateHome.Label, Mode=OneWay}"
357357
Command="{x:Bind Commands.NavigateHome, Mode=OneWay}"
358358
IsEnabled="{x:Bind Commands.NavigateHome.IsExecutable, Mode=OneWay}"
359359
Style="{StaticResource AddressToolbarButtonStyle}"
360360
ToolTipService.ToolTip="{x:Bind Commands.NavigateHome.LabelWithHotKey, Mode=OneWay}">
361-
<FontIcon FontSize="14" Glyph="{x:Bind Commands.NavigateHome.Glyph.BaseGlyph}" />
361+
<FontIcon FontSize="14" Glyph="{x:Bind Commands.NavigateHome.Glyph.BaseGlyph, Mode=OneTime}" />
362362
</Button>
363363
</StackPanel>
364364

@@ -478,13 +478,13 @@
478478
x:Name="ShowSearchButton"
479479
AccessKey="I"
480480
AccessKeyInvoked="Button_AccessKeyInvoked"
481-
AutomationProperties.Name="{x:Bind ViewModel.Commands.Search.Label}"
482-
Command="{x:Bind ViewModel.Commands.Search, Mode=OneWay}"
483-
IsEnabled="{x:Bind ViewModel.Commands.Search.IsExecutable}"
481+
AutomationProperties.Name="{x:Bind Commands.Search.Label, Mode=OneWay}"
482+
Command="{x:Bind Commands.Search, Mode=OneWay}"
483+
IsEnabled="{x:Bind Commands.Search.IsExecutable, Mode=OneWay}"
484484
Style="{StaticResource AddressToolbarButtonStyle}"
485-
ToolTipService.ToolTip="{x:Bind ViewModel.Commands.Search.LabelWithHotKey, Mode=OneWay}"
485+
ToolTipService.ToolTip="{x:Bind Commands.Search.LabelWithHotKey, Mode=OneWay}"
486486
Visibility="Collapsed">
487-
<FontIcon FontSize="14" Glyph="{x:Bind ViewModel.SearchButtonGlyph, Mode=OneWay}" />
487+
<FontIcon FontSize="14" Glyph="{x:Bind ViewModel.SearchButtonGlyph, Mode=OneTime}" />
488488
</Button>
489489

490490
<!-- Shelf Pane -->
@@ -495,11 +495,11 @@
495495
Padding="0"
496496
x:Load="{x:Bind ViewModel.ShowShelfPaneToggleButton, Mode=OneWay}"
497497
AccessKeyInvoked="Button_AccessKeyInvoked"
498-
AutomationProperties.Name="{x:Bind ViewModel.Commands.ToggleShelfPane.Label}"
498+
AutomationProperties.Name="{x:Bind Commands.ToggleShelfPane.Label, Mode=OneWay}"
499499
Background="Transparent"
500500
BorderBrush="Transparent"
501501
IsChecked="{x:Bind Commands.ToggleShelfPane.IsOn, Mode=TwoWay}"
502-
ToolTipService.ToolTip="{x:Bind ViewModel.Commands.ToggleShelfPane.LabelWithHotKey, Mode=OneWay}">
502+
ToolTipService.ToolTip="{x:Bind Commands.ToggleShelfPane.LabelWithHotKey, Mode=OneWay}">
503503
<controls:ThemedIcon
504504
Width="16"
505505
Height="16"
@@ -609,17 +609,16 @@
609609
x:Load="{x:Bind ViewModel.IsAppUpdated, Mode=OneWay}"
610610
AccessKey="2"
611611
AccessKeyInvoked="Button_AccessKeyInvoked"
612-
AutomationProperties.Name="{x:Bind ViewModel.Commands.OpenReleaseNotes.Label}"
613-
Command="{x:Bind ViewModel.Commands.OpenReleaseNotes, Mode=OneWay}"
612+
AutomationProperties.Name="{x:Bind Commands.OpenReleaseNotes.Label, Mode=OneWay}"
613+
Command="{x:Bind Commands.OpenReleaseNotes, Mode=OneWay}"
614614
Style="{StaticResource AddressToolbarButtonStyle}"
615-
ToolTipService.ToolTip="{x:Bind ViewModel.Commands.OpenReleaseNotes.LabelWithHotKey}"
616-
Visibility="{x:Bind ViewModel.Commands.OpenReleaseNotes.IsExecutable, Mode=OneWay}">
615+
ToolTipService.ToolTip="{x:Bind Commands.OpenReleaseNotes.LabelWithHotKey, Mode=OneWay}"
616+
Visibility="{x:Bind Commands.OpenReleaseNotes.IsExecutable, Mode=OneWay}">
617617
<controls:ThemedIcon
618618
Width="16"
619619
Height="16"
620620
Style="{StaticResource App.ThemedIcons.AppUpdatedBox}" />
621621
</Button>
622-
623622
</StackPanel>
624623

625624
<!-- Status Center TeachingTip -->

src/Files.App/UserControls/Pane/InfoPane.xaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@
205205
x:Name="PreviewErrorText"
206206
HorizontalAlignment="Center"
207207
VerticalAlignment="Center"
208-
Text="{x:Bind GetLocalizedResource('NoItemSelected')}"
208+
Text="{helpers:ResourceString Name=NoItemSelected}"
209209
TextWrapping="WrapWholeWords" />
210210
<ContentPresenter
211211
x:Name="PreviewControlPresenter"
@@ -505,7 +505,7 @@
505505
</VisualState.StateTriggers>
506506
<VisualState.Setters>
507507
<Setter Target="PreviewErrorText.Visibility" Value="Visible" />
508-
<Setter Target="PreviewErrorText.Text" Value="{x:Bind GetLocalizedResource('DetailsPanePreviewNotAvaliableText')}" />
508+
<Setter Target="PreviewErrorText.Text" Value="{helpers:ResourceString Name=DetailsPanePreviewNotAvaliableText}" />
509509
<Setter Target="FileDetailsRepeater.Visibility" Value="Visible" />
510510
<Setter Target="DetailsTagsList.Visibility" Value="Visible" />
511511
<Setter Target="DetailsOpenProperties.Visibility" Value="Visible" />
@@ -519,7 +519,7 @@
519519
</VisualState.StateTriggers>
520520
<VisualState.Setters>
521521
<Setter Target="PreviewErrorText.Visibility" Value="Visible" />
522-
<Setter Target="PreviewErrorText.Text" Value="{x:Bind GetLocalizedResource('DetailsPanePreviewNotAvaliableText')}" />
522+
<Setter Target="PreviewErrorText.Text" Value="{helpers:ResourceString Name=DetailsPanePreviewNotAvaliableText}" />
523523
<Setter Target="FileDetailsRepeater.Visibility" Value="Collapsed" />
524524
<Setter Target="DetailsTagsList.Visibility" Value="Collapsed" />
525525
<Setter Target="DetailsOpenProperties.Visibility" Value="Collapsed" />

src/Files.App/UserControls/Pane/InfoPane.xaml.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ public void UpdatePosition(double panelWidth, double panelHeight)
5252
}
5353
}
5454

55-
private string GetLocalizedResource(string resName) => resName.GetLocalizedResource();
56-
5755
private void Root_Unloaded(object sender, RoutedEventArgs e)
5856
{
5957
PreviewControlPresenter.Content = null;

0 commit comments

Comments
 (0)