Skip to content

Commit a84fab4

Browse files
authored
Extended click area to whole settings' block (#7336)
1 parent 6ad7271 commit a84fab4

File tree

8 files changed

+71
-87
lines changed

8 files changed

+71
-87
lines changed

src/Files/Strings/en-US/Resources.resw

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -870,12 +870,6 @@
870870
<data name="VerticalTabFlyout.ToolTipService.ToolTip" xml:space="preserve">
871871
<value>Vertical tab flyout</value>
872872
</data>
873-
<data name="SettingsPreferencesEditTerminalApplications.AutomationProperties.Name" xml:space="preserve">
874-
<value>Edit terminal applications</value>
875-
</data>
876-
<data name="SettingsPreferencesEditTerminalApplications.ToolTipService.ToolTip" xml:space="preserve">
877-
<value>Edit terminal applications</value>
878-
</data>
879873
<data name="SettingsPreferencesAppLanguage.Title" xml:space="preserve">
880874
<value>Language</value>
881875
</data>
@@ -2434,12 +2428,6 @@ We use App Center to keep track of app usage, find bugs, and fix crashes. All in
24342428
<data name="DetailsViewHeaderFlyout_ShowFileTag.Text" xml:space="preserve">
24352429
<value>File tag</value>
24362430
</data>
2437-
<data name="SettingsEditFileTags.AutomationProperties.Name" xml:space="preserve">
2438-
<value>Edit file tags</value>
2439-
</data>
2440-
<data name="SettingsEditFileTags.ToolTipService.ToolTip" xml:space="preserve">
2441-
<value>Edit file tags</value>
2442-
</data>
24432431
<data name="SettingsEditFileTagsExpander.Title" xml:space="preserve">
24442432
<value>Edit file tags</value>
24452433
</data>

src/Files/UserControls/Settings/SettingsBlockControl.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
<Grid x:Name="ButtonGrid" x:Load="{x:Bind IsClickable, Mode=OneWay}">
8484
<Button
8585
x:Name="ActionableButton"
86-
Click="ActionableButton_Click"
86+
Command="{x:Bind ButtonCommand, Mode=OneWay}"
8787
Style="{StaticResource ButtonSettingsBlockStyle}">
8888
<local:SettingsDisplayControl
8989
Title="{x:Bind Title, Mode=OneWay}"

src/Files/UserControls/Settings/SettingsBlockControl.xaml.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Windows.Input;
23
using Windows.UI.Xaml;
34
using Windows.UI.Xaml.Controls;
45
using Windows.UI.Xaml.Markup;
@@ -10,6 +11,15 @@ public sealed partial class SettingsBlockControl : UserControl
1011
{
1112
public FrameworkElement SettingsActionableElement { get; set; }
1213

14+
15+
public ICommand ButtonCommand
16+
{
17+
get { return (ICommand)GetValue(ButtonCommandProperty); }
18+
set { SetValue(ButtonCommandProperty, value); }
19+
}
20+
public static readonly DependencyProperty ButtonCommandProperty =
21+
DependencyProperty.Register("ButtonCommand", typeof(ICommand), typeof(SettingsBlockControl), new PropertyMetadata(null));
22+
1323
public static readonly DependencyProperty ExpandableContentProperty = DependencyProperty.Register(
1424
"ExpandableContent",
1525
typeof(FrameworkElement),
@@ -111,11 +121,6 @@ public SettingsBlockControl()
111121
this.InitializeComponent();
112122
}
113123

114-
private void ActionableButton_Click(object sender, RoutedEventArgs e)
115-
{
116-
Click?.Invoke(this, ExpanderControl.IsExpanded);
117-
}
118-
119124
private void Expander_Expanding(Microsoft.UI.Xaml.Controls.Expander sender, Microsoft.UI.Xaml.Controls.ExpanderExpandingEventArgs args)
120125
{
121126
Click?.Invoke(this, true);

src/Files/UserControls/Settings/SettingsDisplayControl.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
xmlns:local="using:Files.UserControls.Settings"
77
xmlns:local1="using:Files.Converters"
88
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
9+
MinHeight="40"
910
d:DesignHeight="300"
1011
d:DesignWidth="400"
1112
SizeChanged="MainPanel_SizeChanged"

src/Files/Views/SettingsPages/About.xaml

Lines changed: 29 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
</ResourceDictionary.MergedDictionaries>
2020
</ResourceDictionary>
2121
</Page.Resources>
22-
<Page.DataContext>
23-
<settingsviewmodels:AboutViewModel />
24-
</Page.DataContext>
2522

2623
<Grid>
2724
<StackPanel
@@ -41,15 +38,15 @@
4138
Text="{helpers:ResourceString Name=About}" />
4239

4340
<local:SettingsBlockControl
44-
Title="{Binding AppName}"
41+
Title="{x:Bind ViewModel.AppName}"
4542
HorizontalAlignment="Stretch"
46-
Description="{Binding Version}">
43+
Description="{x:Bind ViewModel.Version}">
4744
<local:SettingsBlockControl.Icon>
4845
<FontIcon Glyph="&#xE946;" />
4946
</local:SettingsBlockControl.Icon>
5047
<Button
5148
x:Name="CopyVersionInfo"
52-
Command="{Binding CopyVersionInfoCommand}"
49+
Command="{x:Bind ViewModel.CopyVersionInfoCommand}"
5350
Content="{helpers:ResourceString Name=Copy}" />
5451
</local:SettingsBlockControl>
5552

@@ -61,39 +58,33 @@
6158
<StackPanel>
6259

6360
<!-- Export -->
64-
<local:SettingsBlockControl Title="{helpers:ResourceString Name=ExportSettings}">
61+
<local:SettingsBlockControl
62+
Title="{helpers:ResourceString Name=ExportSettings}"
63+
ButtonCommand="{x:Bind ViewModel.ExportSettingsCommand}"
64+
IsClickable="True">
6565
<local:SettingsBlockControl.Icon>
6666
<FontIcon Glyph="&#xEDE1;" />
6767
</local:SettingsBlockControl.Icon>
6868

69-
<Button
70-
Padding="8"
71-
AutomationProperties.Name="{helpers:ResourceString Name=ExportSettings}"
72-
Command="{Binding ExportSettingsCommand}"
73-
ToolTipService.ToolTip="{helpers:ResourceString Name=ExportSettings}">
74-
<FontIcon
75-
FontSize="14"
76-
Foreground="{ThemeResource TextFillColorPrimaryBrush}"
77-
Glyph="&#xE2B4;" />
78-
</Button>
69+
<FontIcon
70+
FontSize="14"
71+
Foreground="{ThemeResource TextFillColorPrimaryBrush}"
72+
Glyph="&#xE2B4;" />
7973
</local:SettingsBlockControl>
8074

8175
<!-- Import -->
82-
<local:SettingsBlockControl Title="{helpers:ResourceString Name=ImportSettings}">
76+
<local:SettingsBlockControl
77+
Title="{helpers:ResourceString Name=ImportSettings}"
78+
ButtonCommand="{x:Bind ViewModel.ImportSettingsCommand}"
79+
IsClickable="True">
8380
<local:SettingsBlockControl.Icon>
8481
<FontIcon Glyph="&#xE8B5;" />
8582
</local:SettingsBlockControl.Icon>
8683

87-
<Button
88-
Padding="8"
89-
AutomationProperties.Name="{helpers:ResourceString Name=ImportSettings}"
90-
Command="{Binding ImportSettingsCommand}"
91-
ToolTipService.ToolTip="{helpers:ResourceString Name=ImportSettings}">
92-
<FontIcon
93-
FontSize="14"
94-
Foreground="{ThemeResource TextFillColorPrimaryBrush}"
95-
Glyph="&#xE2B4;" />
96-
</Button>
84+
<FontIcon
85+
FontSize="14"
86+
Foreground="{ThemeResource TextFillColorPrimaryBrush}"
87+
Glyph="&#xE2B4;" />
9788
</local:SettingsBlockControl>
9889
</StackPanel>
9990
</local:SettingsBlockControl.ExpandableContent>
@@ -217,7 +208,7 @@
217208
</GridViewItem>
218209
<i:Interaction.Behaviors>
219210
<ic:EventTriggerBehavior EventName="ItemClick">
220-
<ic:InvokeCommandAction Command="{Binding ClickAboutFeedbackItemCommand}" />
211+
<ic:InvokeCommandAction Command="{x:Bind ViewModel.ClickAboutFeedbackItemCommand}" />
221212
</ic:EventTriggerBehavior>
222213
</i:Interaction.Behaviors>
223214
</GridView>
@@ -241,24 +232,19 @@
241232
</local:SettingsBlockControl.ExpandableContent>
242233
</local:SettingsBlockControl>
243234

244-
<local:SettingsBlockControl Title="{helpers:ResourceString Name=OpenLogLocation}" HorizontalAlignment="Stretch">
235+
<local:SettingsBlockControl
236+
Title="{helpers:ResourceString Name=OpenLogLocation}"
237+
HorizontalAlignment="Stretch"
238+
ButtonCommand="{x:Bind ViewModel.OpenLogLocationCommand}"
239+
IsClickable="True">
245240
<local:SettingsBlockControl.Icon>
246241
<FontIcon Glyph="&#xE838;" />
247242
</local:SettingsBlockControl.Icon>
248243

249-
<Button
250-
x:Name="OpenLogLocationButton"
251-
Padding="8"
252-
AutomationProperties.Name="{helpers:ResourceString Name=OpenLogLocation}"
253-
Command="{Binding OpenLogLocationCommand}"
254-
ToolTipService.ToolTip="{helpers:ResourceString Name=OpenLogLocation}">
255-
<Button.Content>
256-
<FontIcon
257-
FontSize="14"
258-
Foreground="{ThemeResource TextFillColorPrimaryBrush}"
259-
Glyph="&#xE2B4;" />
260-
</Button.Content>
261-
</Button>
244+
<FontIcon
245+
FontSize="14"
246+
Foreground="{ThemeResource TextFillColorPrimaryBrush}"
247+
Glyph="&#xE2B4;" />
262248
</local:SettingsBlockControl>
263249

264250
<local:SettingsBlockControl Title="{helpers:ResourceString Name=ThirdPartyLicenses}" HorizontalAlignment="Stretch">
Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
1-
using Windows.UI.Xaml.Controls;
1+
using Files.ViewModels.SettingsViewModels;
2+
using Windows.UI.Xaml.Controls;
23

34
namespace Files.SettingsPages
45
{
56
public sealed partial class About : Page
67
{
8+
public AboutViewModel ViewModel
9+
{
10+
get => (AboutViewModel)DataContext;
11+
set => DataContext = value;
12+
}
13+
714
public About()
815
{
916
InitializeComponent();
17+
18+
this.ViewModel = new AboutViewModel();
1019
}
1120
}
1221
}

src/Files/Views/SettingsPages/Experimental.xaml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,25 +50,22 @@
5050
</local:SettingsBlockControl.Icon>
5151
<ToggleSwitch IsOn="{Binding AreFileTagsEnabled, Mode=TwoWay}" Style="{StaticResource RightAlignedToggleSwitchStyle}" />
5252
<local:SettingsBlockControl.ExpandableContent>
53-
<local:SettingsBlockControl x:Uid="SettingsEditFileTagsExpander" Title="Edit file tags">
53+
<local:SettingsBlockControl
54+
x:Uid="SettingsEditFileTagsExpander"
55+
Title="Edit file tags"
56+
ButtonCommand="{Binding EditFileTagsCommand}"
57+
IsClickable="True">
5458
<local:SettingsBlockControl.Icon>
5559
<FontIcon
5660
FontSize="14"
5761
Foreground="{ThemeResource TextFillColorPrimaryBrush}"
5862
Glyph="&#xE104;" />
5963
</local:SettingsBlockControl.Icon>
60-
<HyperlinkButton
61-
x:Uid="SettingsEditFileTags"
62-
Height="32"
63-
Padding="8,4,8,4"
64-
VerticalAlignment="Bottom"
65-
AutomationProperties.Name="Edit file tags"
66-
Command="{Binding EditFileTagsCommand}">
67-
<FontIcon
68-
FontSize="14"
69-
Foreground="{ThemeResource TextFillColorPrimaryBrush}"
70-
Glyph="&#xE2B4;" />
71-
</HyperlinkButton>
64+
65+
<FontIcon
66+
FontSize="14"
67+
Foreground="{ThemeResource TextFillColorPrimaryBrush}"
68+
Glyph="&#xE2B4;" />
7269
</local:SettingsBlockControl>
7370
</local:SettingsBlockControl.ExpandableContent>
7471
</local:SettingsBlockControl>

src/Files/Views/SettingsPages/Preferences.xaml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,24 +91,22 @@
9191
</ComboBox.ItemTemplate>
9292
</ComboBox>
9393
<local:SettingsBlockControl.ExpandableContent>
94-
<local:SettingsBlockControl x:Uid="SettingsPreferencesEditTerminalApplicationsExpander" Title="Edit terminal applications">
94+
<local:SettingsBlockControl
95+
x:Uid="SettingsPreferencesEditTerminalApplicationsExpander"
96+
Title="Edit terminal applications"
97+
ButtonCommand="{Binding EditTerminalApplicationsCommand}"
98+
IsClickable="True">
9599
<local:SettingsBlockControl.Icon>
96100
<FontIcon
97101
FontSize="14"
98102
Foreground="{ThemeResource TextFillColorPrimaryBrush}"
99103
Glyph="&#xE104;" />
100104
</local:SettingsBlockControl.Icon>
101-
<HyperlinkButton
102-
x:Uid="SettingsPreferencesEditTerminalApplications"
103-
Height="32"
104-
Padding="8,4,8,4"
105-
AutomationProperties.Name="Edit terminal applications"
106-
Command="{Binding EditTerminalApplicationsCommand}">
107-
<FontIcon
108-
FontSize="14"
109-
Foreground="{ThemeResource TextFillColorPrimaryBrush}"
110-
Glyph="&#xE2B4;" />
111-
</HyperlinkButton>
105+
106+
<FontIcon
107+
FontSize="14"
108+
Foreground="{ThemeResource TextFillColorPrimaryBrush}"
109+
Glyph="&#xE2B4;" />
112110
</local:SettingsBlockControl>
113111
</local:SettingsBlockControl.ExpandableContent>
114112
</local:SettingsBlockControl>

0 commit comments

Comments
 (0)