Skip to content

Commit

Permalink
[Settings]XamlStyler formatting (microsoft#29114)
Browse files Browse the repository at this point in the history
* XamlStyler formatting

* add generated files exclusion
  • Loading branch information
davidegiacometti authored Oct 24, 2023
1 parent 8eb4867 commit 536c723
Show file tree
Hide file tree
Showing 41 changed files with 720 additions and 1,162 deletions.
2 changes: 1 addition & 1 deletion .pipelines/applyXamlStyling.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ if (-not $Passive)
else
{
Write-Output "Checking all files (passively)"
$files = Get-ChildItem -Path "$PSScriptRoot\..\src\*.xaml" -Recurse | Select-Object -ExpandProperty FullName | Where-Object { $_ -notmatch "(\\obj\\)|(\\bin\\)|(\\x64\\)|(\\launcher\\PowerLauncher\\)|(\\launcher\\Wox.Plugin\\)|(\\colorPicker\\ColorPickerUI\\)|(\\settings-ui\\Settings.UI\\)" }
$files = Get-ChildItem -Path "$PSScriptRoot\..\src\*.xaml" -Recurse | Select-Object -ExpandProperty FullName | Where-Object { $_ -notmatch "(\\obj\\)|(\\bin\\)|(\\x64\\)|(\\Generated Files\\PowerRenameXAML\\)|(\\launcher\\PowerLauncher\\)|(\\launcher\\Wox.Plugin\\)|(\\colorPicker\\ColorPickerUI\\)" }

if ($files.count -gt 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,39 +11,23 @@
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Dark">
<SolidColorBrush
x:Key="SolidBackgroundBrush"
Color="Black" />
<SolidColorBrush
x:Key="SolidZoneNumberBrush"
Color="White" />
<SolidColorBrush x:Key="SolidBackgroundBrush" Color="Black" />
<SolidColorBrush x:Key="SolidZoneNumberBrush" Color="White" />
</ResourceDictionary>
<ResourceDictionary x:Key="Light">
<SolidColorBrush
x:Key="SolidBackgroundBrush"
Color="White" />
<SolidColorBrush
x:Key="SolidZoneNumberBrush"
Color="Black" />
<SolidColorBrush x:Key="SolidBackgroundBrush" Color="White" />
<SolidColorBrush x:Key="SolidZoneNumberBrush" Color="Black" />
</ResourceDictionary>
<ResourceDictionary x:Key="HighContrast">
<SolidColorBrush
x:Key="SolidBackgroundBrush"
Color="Black" />
<SolidColorBrush
x:Key="SolidZoneNumberBrush"
Color="White" />
<SolidColorBrush x:Key="SolidBackgroundBrush" Color="Black" />
<SolidColorBrush x:Key="SolidZoneNumberBrush" Color="White" />
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
<SolidColorBrush
x:Key="DefaultAccentBrush"
Color="{ThemeResource SystemAccentColor}" />
<SolidColorBrush
x:Key="DefaultBorderBrush"
Color="{ThemeResource SystemAccentColor}" />
<SolidColorBrush x:Key="DefaultAccentBrush" Color="{ThemeResource SystemAccentColor}" />
<SolidColorBrush x:Key="DefaultBorderBrush" Color="{ThemeResource SystemAccentColor}" />
</ResourceDictionary>
</UserControl.Resources>

<Grid
x:Name="RootGrid"
MinWidth="170"
Expand All @@ -64,21 +48,21 @@
<Border
Grid.RowSpan="2"
Grid.ColumnSpan="2"
Opacity="0.8"
CornerRadius="4">
CornerRadius="4"
Opacity="0.8">
<Image
AutomationProperties.AccessibilityView="Raw"
AutomationProperties.AccessibilityView="Raw"
Source="{x:Bind WallpaperPath, Mode=OneWay}"
Stretch="UniformToFill" />
</Border>

<Border
x:Name="Zone1"
Grid.RowSpan="2"
BorderThickness="1"
Margin="4,4,2,4"
CornerRadius="2"
Background="{ThemeResource SystemControlAcrylicElementBrush}">
Background="{ThemeResource SystemControlAcrylicElementBrush}"
BorderThickness="1"
CornerRadius="2">
<TextBlock
x:Name="Zone1Number"
HorizontalAlignment="Center"
Expand All @@ -90,10 +74,10 @@
<Border
x:Name="Zone2"
Grid.Column="1"
BorderThickness="1"
Margin="2,4,4,2"
CornerRadius="2"
Background="{ThemeResource SystemControlAcrylicElementBrush}">
Background="{ThemeResource SystemControlAcrylicElementBrush}"
BorderThickness="1"
CornerRadius="2">
<TextBlock
x:Name="Zone2Number"
HorizontalAlignment="Center"
Expand All @@ -106,10 +90,10 @@
x:Name="Zone3"
Grid.Row="1"
Grid.Column="1"
BorderThickness="1"
Margin="2,2,4,4"
CornerRadius="2"
Background="{ThemeResource SystemControlAcrylicElementBrush}">
Background="{ThemeResource SystemControlAcrylicElementBrush}"
BorderThickness="1"
CornerRadius="2">
<TextBlock
x:Name="Zone3Number"
HorizontalAlignment="Center"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@
</Style>
<Style
x:Key="SecondaryIsEnabledTextBlockStyle"
TargetType="local:IsEnabledTextBlock"
BasedOn="{StaticResource DefaultIsEnabledTextBlockStyle}"
>
TargetType="local:IsEnabledTextBlock">
<Setter Property="Foreground" Value="{ThemeResource TextFillColorSecondaryBrush}" />
<Setter Property="FontSize" Value="{StaticResource SecondaryTextFontSize}" />
</Style>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,26 @@
<Setter.Value>
<ControlTemplate TargetType="local:KeyVisual">
<Grid>
<Grid>
<Rectangle
x:Name="ContentHolder"
Height="{TemplateBinding Height}"
MinWidth="{TemplateBinding MinWidth}"
Fill="{TemplateBinding Background}"
RadiusX="4"
RadiusY="4"
Stroke="{TemplateBinding BorderBrush}"
StrokeThickness="{TemplateBinding BorderThickness}" />
<ContentPresenter
x:Name="KeyPresenter"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="Center"
Content="{TemplateBinding Content}"
FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}"
Foreground="{TemplateBinding Foreground}" />
</Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
Expand All @@ -45,26 +65,6 @@
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid>
<Rectangle
x:Name="ContentHolder"
Height="{TemplateBinding Height}"
MinWidth="{TemplateBinding MinWidth}"
Fill="{TemplateBinding Background}"
RadiusX="4"
RadiusY="4"
Stroke="{TemplateBinding BorderBrush}"
StrokeThickness="{TemplateBinding BorderThickness}" />
<ContentPresenter
x:Name="KeyPresenter"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="Center"
Content="{TemplateBinding Content}"
FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}"
Foreground="{TemplateBinding Foreground}" />
</Grid>
</Grid>
</ControlTemplate>
</Setter.Value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
ItemsSource="{x:Bind Keys}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel
Orientation="Horizontal"
Spacing="4" />
<StackPanel Orientation="Horizontal" Spacing="4" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
x:Class="Microsoft.PowerToys.Settings.UI.Controls.SettingsPageControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:custom="using:CommunityToolkit.WinUI.UI.Controls"
xmlns:converters="using:CommunityToolkit.WinUI.Converters"
xmlns:custom="using:CommunityToolkit.WinUI.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Expand All @@ -24,25 +24,6 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<VisualState>
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="480" />
</VisualState.StateTriggers>
</VisualState>
<VisualState>
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="0" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="DescriptionPanel.(Grid.Row)" Value="1" />
<Setter Target="DescriptionPanel.(Grid.Column)" Value="0" />
<Setter Target="DescriptionPanel.(Grid.ColumnSpan)" Value="2" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<TextBlock
x:Name="Header"
MaxWidth="{StaticResource PageMaxWidth}"
Expand Down Expand Up @@ -157,5 +138,24 @@
</StackPanel>
</Grid>
</ScrollViewer>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<VisualState>
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="480" />
</VisualState.StateTriggers>
</VisualState>
<VisualState>
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="0" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="DescriptionPanel.(Grid.Row)" Value="1" />
<Setter Target="DescriptionPanel.(Grid.Column)" Value="0" />
<Setter Target="DescriptionPanel.(Grid.ColumnSpan)" Value="2" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</UserControl>
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,14 @@
xmlns:toolkitcontrols="using:CommunityToolkit.WinUI.UI.Controls"
x:Name="ShortcutContentControl"
mc:Ignorable="d">
<Grid
MinWidth="498"
MinHeight="220">
<Grid MinWidth="498" MinHeight="220">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition MinHeight="110" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>

<TextBlock
Grid.Row="0" />
<TextBlock Grid.Row="0" />

<ItemsControl
x:Name="KeysControl"
Expand All @@ -31,9 +28,7 @@
ItemsSource="{x:Bind Keys, Mode=OneWay}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel
Orientation="Horizontal"
Spacing="8" />
<StackPanel Orientation="Horizontal" Spacing="8" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
Expand All @@ -57,11 +52,12 @@
Spacing="8">
<Grid Height="62">

<InfoBar x:Uid="InvalidShortcut"
IsClosable="False"
IsOpen="{Binding ElementName=ShortcutContentControl, Path=IsError, Mode=OneWay}"
IsTabStop="{Binding ElementName=ShortcutContentControl, Path=IsError, Mode=OneWay}"
Severity="Error" />
<InfoBar
x:Uid="InvalidShortcut"
IsClosable="False"
IsOpen="{Binding ElementName=ShortcutContentControl, Path=IsError, Mode=OneWay}"
IsTabStop="{Binding ElementName=ShortcutContentControl, Path=IsError, Mode=OneWay}"
Severity="Error" />

</Grid>
<toolkitcontrols:MarkdownTextBlock
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<!-- Copyright (c) Microsoft Corporation and Contributors. -->
<!-- Copyright (c) Microsoft Corporation and Contributors. -->
<!-- Licensed under the MIT License. -->

<Page
x:Class="Microsoft.PowerToys.Settings.UI.Flyout.AppsListPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:converters="using:CommunityToolkit.WinUI.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:viewmodels="using:Microsoft.PowerToys.Settings.UI.ViewModels"
mc:Ignorable="d">
Expand Down Expand Up @@ -71,8 +71,8 @@
<!--<ViewBox VerticalAlignment="Center">-->
<Image
Width="20"
VerticalAlignment="Center"
Margin="0,0,16,0">
Margin="0,0,16,0"
VerticalAlignment="Center">
<Image.Source>
<BitmapImage UriSource="{x:Bind Icon, Mode=OneWay}" />
</Image.Source>
Expand All @@ -86,9 +86,9 @@
<FontIcon
Grid.Column="2"
Width="20"
VerticalAlignment="Center"
FontSize="16"
Glyph="&#xE72E;"
VerticalAlignment="Center"
Visibility="{x:Bind IsLocked, Converter={StaticResource BoolToInvertedVisibilityConverter}, ConverterParameter=True, Mode=OneWay}">
<ToolTipService.ToolTip>
<TextBlock x:Uid="GPO_IsSettingForcedText" TextWrapping="WrapWholeWords" />
Expand Down
18 changes: 7 additions & 11 deletions src/settings-ui/Settings.UI/SettingsXAML/FlyoutWindow.xaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<winuiex:WindowEx
<winuiex:WindowEx
x:Class="Microsoft.PowerToys.Settings.UI.FlyoutWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:flyout="using:Microsoft.PowerToys.Settings.UI.Flyout"
xmlns:i="using:Microsoft.Xaml.Interactivity"
xmlns:ic="using:Microsoft.Xaml.Interactions.Core"
xmlns:local="using:Microsoft.PowerToys.Settings.UI"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:winuiex="using:WinUIEx"
xmlns:i="using:Microsoft.Xaml.Interactivity"
xmlns:ic="using:Microsoft.Xaml.Interactions.Core"
Title="PowerToys Settings"
IsAlwaysOnTop="True"
IsMaximizable="False"
Expand All @@ -29,19 +29,15 @@
LightTintOpacity="0" />
</winuiex:WindowEx.Backdrop>
<Grid>
<!-- HACK: https://github.com/microsoft/microsoft-ui-xaml/issues/7629 -->
<!-- W11 grey border, W10: no border -->
<!-- HACK: https://github.com/microsoft/microsoft-ui-xaml/issues/7629 -->
<!-- W11 grey border, W10: no border -->
<i:Interaction.Behaviors>
<ic:DataTriggerBehavior
Binding="{x:Bind ViewModel.Windows10}"
ComparisonCondition="Equal"
Value="True">
<ic:ChangePropertyAction
PropertyName="BorderThickness"
Value="1" />
<ic:ChangePropertyAction
PropertyName="BorderBrush"
Value="{ThemeResource SurfaceStrokeColorDefaultBrush}" />
<ic:ChangePropertyAction PropertyName="BorderThickness" Value="1" />
<ic:ChangePropertyAction PropertyName="BorderBrush" Value="{ThemeResource SurfaceStrokeColorDefaultBrush}" />
</ic:DataTriggerBehavior>
</i:Interaction.Behaviors>
<flyout:ShellPage x:Name="FlyoutShellPage" />
Expand Down
4 changes: 2 additions & 2 deletions src/settings-ui/Settings.UI/SettingsXAML/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<winuiex:WindowEx
<winuiex:WindowEx
x:Class="Microsoft.PowerToys.Settings.UI.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Expand All @@ -11,7 +11,7 @@
Closed="Window_Closed"
mc:Ignorable="d">
<Window.SystemBackdrop>
<MicaBackdrop/>
<MicaBackdrop />
</Window.SystemBackdrop>
<local:ShellPage x:Name="shellPage" />
</winuiex:WindowEx>
Loading

0 comments on commit 536c723

Please sign in to comment.