Skip to content

Commit a3193ee

Browse files
ferrariofilippoyaira2
authored andcommitted
Suggested UI Changes
1 parent 7b10006 commit a3193ee

File tree

2 files changed

+34
-21
lines changed

2 files changed

+34
-21
lines changed

src/Files.App/Views/Settings/DevToolsPage.xaml

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
<StackPanel Orientation="Vertical">
6464
<Grid
6565
x:Name="IDEConfigGrid"
66-
Padding="32,12"
66+
Padding="60,12,16,12"
6767
ColumnSpacing="16"
6868
RowSpacing="12">
6969
<Grid.ColumnDefinitions>
@@ -75,10 +75,8 @@
7575
<Grid.RowDefinitions>
7676
<RowDefinition Height="*" />
7777
<RowDefinition Height="*" />
78-
<RowDefinition Height="Auto" />
7978
</Grid.RowDefinitions>
8079

81-
8280
<!-- IDE Friendly Name -->
8381
<TextBlock
8482
x:Name="IDEFriendlyName"
@@ -111,11 +109,11 @@
111109
x:Name="InvalidFriendlyNameWarning"
112110
Title="{helpers:ResourceString Name=InvalidFriendlyNameError}"
113111
IsOpen="{x:Bind ViewModel.IsFriendlyNameValid, Converter={StaticResource BoolNegationConverter}, Mode=OneWay}"
114-
PreferredPlacement="BottomRight"
112+
PreferredPlacement="BottomLeft"
115113
Target="{x:Bind IDEFriendlyNameTextBox}" />
116114
</TextBox.Resources>
117115
<TextBox.Header>
118-
<TextBlock Text="{helpers:ResourceString Name=FriendlyName}" TextTrimming="CharacterEllipsis" />
116+
<TextBlock Text="{helpers:ResourceString Name=FriendlyName}" />
119117
</TextBox.Header>
120118
</TextBox>
121119

@@ -169,20 +167,30 @@
169167
<SolidColorBrush x:Key="TextControlBackgroundFocused" Color="{ThemeResource SolidBackgroundFillColorSecondary}" />
170168
</TextBox.Resources>
171169
<TextBox.Header>
172-
<TextBlock Text="{helpers:ResourceString Name=PathOrAlias}" TextTrimming="CharacterEllipsis" />
170+
<TextBlock Text="{helpers:ResourceString Name=PathOrAlias}" />
173171
</TextBox.Header>
174172
</TextBox>
175173

176-
<Button
174+
<SplitButton
177175
x:Name="PickIDEExe"
178176
Grid.Column="1"
179177
VerticalAlignment="Bottom"
180178
Command="{x:Bind ViewModel.OpenFilePickerForIDECommand, Mode=OneWay}"
181-
Content="{helpers:ResourceString Name=Browse}" />
179+
Content="{helpers:ResourceString Name=Browse}">
180+
<SplitButton.Flyout>
181+
<MenuFlyout Placement="Bottom">
182+
<!-- Test Integration -->
183+
<MenuFlyoutItem
184+
x:Name="TestIDE"
185+
Command="{x:Bind ViewModel.TestIDECommand, Mode=OneWay}"
186+
IsEnabled="{x:Bind ViewModel.IsIDEPathValid, Mode=OneWay}"
187+
Text="{helpers:ResourceString Name=TestIntegration}" />
188+
</MenuFlyout>
189+
</SplitButton.Flyout>
190+
</SplitButton>
182191

183192
<Grid
184193
x:Name="InvalidPathWarning"
185-
Grid.Row="1"
186194
Grid.Column="2"
187195
Padding="12,6"
188196
VerticalAlignment="Bottom"
@@ -224,9 +232,10 @@
224232
<!-- Edit -->
225233
<Button
226234
x:Name="EditIDEConfigButton"
227-
Grid.RowSpan="3"
235+
Grid.RowSpan="2"
228236
Grid.Column="2"
229237
Padding="8,4"
238+
VerticalAlignment="Center"
230239
Background="Transparent"
231240
BorderBrush="Transparent"
232241
Command="{x:Bind ViewModel.StartEditingIDECommand, Mode=OneWay}"
@@ -236,20 +245,14 @@
236245

237246
<StackPanel
238247
x:Name="SaveAndEditButtons"
239-
Padding="32,0,32,12"
248+
Padding="60,0,16,12"
240249
HorizontalAlignment="Right"
241250
x:Load="{x:Bind ViewModel.IsEditingIDEConfig, Mode=OneWay}"
242251
Orientation="Horizontal"
243252
Spacing="8">
244253
<!-- Cancel -->
245254
<Button Command="{x:Bind ViewModel.CancelIDEChangesCommand, Mode=OneWay}" Content="{helpers:ResourceString Name=Cancel}" />
246255

247-
<!-- Test Integration -->
248-
<Button
249-
x:Name="TestIDE"
250-
Command="{x:Bind ViewModel.TestIDECommand, Mode=OneWay}"
251-
Content="{helpers:ResourceString Name=TestIntegration}" />
252-
253256
<!-- Save Changes -->
254257
<Button
255258
Command="{x:Bind ViewModel.SaveIDEChangesCommand, Mode=OneWay}"
@@ -304,7 +307,6 @@
304307
<Setter Target="InvalidPathWarning.VerticalAlignment" Value="Bottom" />
305308
<Setter Target="IDEPathGrid.RowSpacing" Value="0" />
306309
<Setter Target="IDEPathGrid.ColumnSpacing" Value="8" />
307-
<Setter Target="InvalidFriendlyNameWarning.PreferredPlacement" Value="BottomRight" />
308310
</VisualState.Setters>
309311
</VisualState>
310312
<VisualState x:Name="CompactState">
@@ -322,7 +324,6 @@
322324
<Setter Target="InvalidPathWarning.VerticalAlignment" Value="Stretch" />
323325
<Setter Target="IDEPathGrid.RowSpacing" Value="12" />
324326
<Setter Target="IDEPathGrid.ColumnSpacing" Value="0" />
325-
<Setter Target="InvalidFriendlyNameWarning.PreferredPlacement" Value="Bottom" />
326327
</VisualState.Setters>
327328
</VisualState>
328329
</VisualStateGroup>

src/Files.App/Views/Settings/DevToolsPage.xaml.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) Files Community
22
// Licensed under the MIT License.
33

4+
using Files.App.ViewModels.Settings;
45
using Microsoft.UI.Xaml;
56
using Microsoft.UI.Xaml.Controls;
67

@@ -11,18 +12,29 @@ public sealed partial class DevToolsPage : Page
1112
public DevToolsPage()
1213
{
1314
InitializeComponent();
15+
ViewModel.PropertyChanged += ViewModel_PropertyChanged;
16+
}
17+
18+
private void ViewModel_PropertyChanged(object? sender, PropertyChangedEventArgs e)
19+
{
20+
if (e.PropertyName is nameof(DevToolsViewModel.IsEditingIDEConfig))
21+
SetVisualState(ActualWidth);
1422
}
1523

1624
private void Page_SizeChanged(object sender, SizeChangedEventArgs e)
1725
{
1826
if (e.NewSize.Width == e.PreviousSize.Width)
1927
return;
2028

29+
SetVisualState(e.NewSize.Width);
30+
}
31+
32+
private void SetVisualState(double width)
33+
{
2134
var defaultPathWidth = 300;
2235
var pickIDEWidth = PickIDEExe.ActualWidth == 0 ? 64 : PickIDEExe.ActualWidth;
23-
2436
var minWidth = defaultPathWidth + pickIDEWidth;
25-
var state = minWidth > e.NewSize.Width / 1.6 ? "CompactState" : "DefaultState";
37+
var state = minWidth > width / 1.6 ? "CompactState" : "DefaultState";
2638
VisualStateManager.GoToState(this, state, false);
2739
}
2840
}

0 commit comments

Comments
 (0)