Auto-format our XAML files and enforce in CI (#9589)

This adds [`XamlStyler.Console`] to our solution, and calls it when we
format the code, to also format
our .xaml files. 
* `XamlStyler.Console` is a dotnet tool so it needs to be restored with
  `dotnet tool restore`
* I've added a set of rules to approximately follow [@cmaneu's XAML guidelines].
  Those guidelines also recommend things based on the code-behind, which
  this tool can't figure out, but also _don't matter that much_.
* There's an extra step to strip BOMs from the output, since Xaml Styler
  adds a BOM by default. Some had them before and others didn't. BOMs
  have been nothing but trouble though.

[`XamlStyler.Console`]: https://github.com/Xavalon/XamlStyler
[@cmaneu's XAML guidelines]: https://github.com/cmaneu/xaml-coding-guidelines
This commit is contained in:
Mike Griese 2021-03-29 17:09:38 -05:00 committed by GitHub
parent c19aa89123
commit 3323dc5724
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
38 changed files with 2839 additions and 2238 deletions

12
.config/dotnet-tools.json Normal file
View File

@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"XamlStyler.Console": {
"version": "3.2008.4",
"commands": [
"xstyler"
]
}
}
}

View File

@ -64,3 +64,4 @@ SUMS$
^\.github/actions/spelling/ ^\.github/actions/spelling/
^\.gitignore$ ^\.gitignore$
^doc/reference/master-sequence-list.csv$ ^doc/reference/master-sequence-list.csv$
^\XamlStyler.json$

View File

@ -2061,6 +2061,7 @@ runtests
runtimeclass runtimeclass
runuia runuia
runut runut
runxamlformat
rvalue rvalue
RVERTICAL RVERTICAL
rxvt rxvt
@ -2852,6 +2853,7 @@ XResource
xsd xsd
xsi xsi
xsize xsize
xstyler
XSubstantial XSubstantial
xtended xtended
xterm xterm

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="vswhere" version="2.6.7" /> <package id="vswhere" version="2.6.7" />
</packages> </packages>

41
XamlStyler.json Normal file
View File

@ -0,0 +1,41 @@
{
"AttributesTolerance": 1,
"KeepFirstAttributeOnSameLine": true,
"MaxAttributeCharactersPerLine": 0,
"MaxAttributesPerLine": 1,
"NewlineExemptionElements": "RadialGradientBrush, GradientStop, LinearGradientBrush, ScaleTransform, SkewTransform, RotateTransform, TranslateTransform, Trigger, Condition, Setter",
"SeparateByGroups": false,
"AttributeIndentation": 0,
"AttributeIndentationStyle": 1,
"RemoveDesignTimeReferences": false,
"EnableAttributeReordering": true,
"AttributeOrderingRuleGroups": [
"x:Class",
"xmlns, xmlns:x",
"xmlns:*",
"x:Key, Key, x:Name, Name, x:Uid, Uid, Title",
"Grid.Row, Grid.RowSpan, Grid.Column, Grid.ColumnSpan, Canvas.Left, Canvas.Top, Canvas.Right, Canvas.Bottom",
"Width, Height, MinWidth, MinHeight, MaxWidth, MaxHeight",
"Margin, Padding, HorizontalAlignment, VerticalAlignment, HorizontalContentAlignment, VerticalContentAlignment, Panel.ZIndex",
"*:*, *",
"PageSource, PageIndex, Offset, Color, TargetName, Property, Value, StartPoint, EndPoint",
"mc:Ignorable, d:IsDataSource, d:LayoutOverrides, d:IsStaticText",
"Storyboard.*, From, To, Duration"
],
"FirstLineAttributes": "",
"OrderAttributesByName": true,
"PutEndingBracketOnNewLine": false,
"RemoveEndingTagOfEmptyElement": true,
"SpaceBeforeClosingSlash": true,
"RootElementLineBreakRule": 0,
"ReorderVSM": 2,
"ReorderGridChildren": false,
"ReorderCanvasChildren": false,
"ReorderSetters": 0,
"FormatMarkupExtension": true,
"NoNewLineMarkupExtensions": "x:Bind, Binding",
"ThicknessSeparator": 2,
"ThicknessAttributes": "Margin, Padding, BorderThickness, ThumbnailClipMargin",
"FormatOnSave": true,
"CommentPadding": 2,
}

View File

@ -3,12 +3,24 @@
# Checks for code formatting errors. Will throw exception if any are found. # Checks for code formatting errors. Will throw exception if any are found.
function Invoke-CheckBadCodeFormatting() { function Invoke-CheckBadCodeFormatting() {
Import-Module ./tools/OpenConsole.psm1 Import-Module ./tools/OpenConsole.psm1
Invoke-CodeFormat
# Don't run the XAML formatter in this step - even if it changes nothing,
# it'll still touch all the .xaml files.
Invoke-CodeFormat -IgnoreXaml
# returns a non-zero exit code if there are any diffs in the tracked files in the repo # returns a non-zero exit code if there are any diffs in the tracked files in the repo
git diff-index --quiet HEAD -- git diff-index --quiet HEAD --
if ($lastExitCode -eq 1) { if ($lastExitCode -eq 1) {
# Write the list of files that need updating to the log
git diff-index --name-only HEAD
throw "code formatting bad, run Invoke-CodeFormat on branch" throw "code formatting bad, run Invoke-CodeFormat on branch"
} }
# Manually check the formatting of our .xaml files, without touching them.
Verify-XamlFormat
} }
Invoke-CheckBadCodeFormatting Invoke-CheckBadCodeFormatting

View File

@ -38,6 +38,7 @@
".wrn", ".wrn",
".rec", ".rec",
".err", ".err",
"XamlStyler.json",
".xlsx" ".xlsx"
] ]
} }

View File

@ -1,8 +1,6 @@
<Application x:Class="GUIConsole.Wpf.App" <Application x:Class="GUIConsole.Wpf.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml"> StartupUri="MainWindow.xaml">
<Application.Resources> <Application.Resources />
</Application>
</Application.Resources>
</Application>

View File

@ -1,84 +1,100 @@
<Window x:Class="GUIConsole.Wpf.MainWindow" <Window x:Class="GUIConsole.Wpf.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" Title="MainWindow"
Width="800"
Title="MainWindow" Height="450" Width="800" Height="450"
Background="#C7000000" AllowsTransparency="True"
AllowsTransparency="True" Background="#C7000000"
WindowStyle="None" BorderBrush="LightSlateGray"
MouseDown="Window_MouseDown" BorderThickness="1"
BorderThickness="1" KeyDown="Window_KeyDown"
BorderBrush="LightSlateGray" Loaded="Window_Loaded"
MouseDown="Window_MouseDown"
KeyDown="Window_KeyDown" WindowStyle="None"
Loaded="Window_Loaded"> mc:Ignorable="d">
<Window.Resources> <Window.Resources>
<Style x:Key="TitleBarButtonStyle" TargetType="{x:Type Button}"> <Style x:Key="TitleBarButtonStyle"
<Setter Property="Background" Value="Transparent"/> TargetType="{x:Type Button}">
<Setter Property="FontFamily" Value="Segoe MDL2 Assets"/> <Setter Property="Background" Value="Transparent" />
<Setter Property="FontSize" Value="14"/> <Setter Property="FontFamily" Value="Segoe MDL2 Assets" />
<Setter Property="Height" Value="32"/> <Setter Property="FontSize" Value="14" />
<Setter Property="Width" Value="46"/> <Setter Property="Height" Value="32" />
<Setter Property="Background" Value="Transparent"/> <Setter Property="Width" Value="46" />
<Setter Property="Foreground" Value="White"/> <Setter Property="Background" Value="Transparent" />
<Setter Property="BorderThickness" Value="0"/> <Setter Property="Foreground" Value="White" />
</Style> <Setter Property="BorderThickness" Value="0" />
</Style>
<Style x:Key="CloseButtonStyle" TargetType="{x:Type Button}" BasedOn="{StaticResource TitleBarButtonStyle}">
<Setter Property="Content" Value="&#xE10A;"/> <Style x:Key="CloseButtonStyle"
<!--Remove the default Button template's Triggers, otherwise they'll override our trigger below.--> BasedOn="{StaticResource TitleBarButtonStyle}"
<Setter Property="Template"> TargetType="{x:Type Button}">
<Setter.Value> <Setter Property="Content" Value="&#xE10A;" />
<ControlTemplate TargetType="{x:Type Button}"> <!-- Remove the default Button template's Triggers, otherwise they'll override our trigger below. -->
<Border Background="{TemplateBinding Background}"> <Setter Property="Template">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/> <Setter.Value>
</Border> <ControlTemplate TargetType="{x:Type Button}">
</ControlTemplate> <Border Background="{TemplateBinding Background}">
</Setter.Value> <ContentPresenter HorizontalAlignment="Center"
</Setter> VerticalAlignment="Center" />
<Style.Triggers> </Border>
<Trigger Property="IsMouseOver" Value="True"> </ControlTemplate>
<Setter Property="Button.Background" Value="Red"/> </Setter.Value>
</Trigger> </Setter>
</Style.Triggers> <Style.Triggers>
</Style> <Trigger Property="IsMouseOver" Value="True">
</Window.Resources> <Setter Property="Button.Background" Value="Red" />
</Trigger>
<Grid> </Style.Triggers>
<Grid.RowDefinitions> </Style>
<RowDefinition Height="Auto"/> </Window.Resources>
<RowDefinition Height="*"/>
</Grid.RowDefinitions> <Grid>
<Grid.RowDefinitions>
<Grid Grid.Row="0"> <RowDefinition Height="Auto" />
<Grid.ColumnDefinitions> <RowDefinition Height="*" />
<ColumnDefinition Width="*"/> </Grid.RowDefinitions>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions> <Grid Grid.Row="0">
<TextBlock x:Name="TitleBarTitle" Grid.Column="0" VerticalAlignment="Center" Padding="10 0" Foreground="White"> <Grid.ColumnDefinitions>
GUIConsole <ColumnDefinition Width="*" />
</TextBlock> <ColumnDefinition Width="Auto" />
<StackPanel x:Name="TitleBarButtons" Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Top"> </Grid.ColumnDefinitions>
<Button x:Name="MinimizeButton" <TextBlock x:Name="TitleBarTitle"
Click="MinimizeButton_Click" Grid.Column="0"
Content="&#xE108;" Padding="10,0"
Style="{StaticResource TitleBarButtonStyle}"/> VerticalAlignment="Center"
<Button x:Name="MaximizeRestoreButton" Foreground="White">
Click="MaximizeRestoreButton_Click" GUIConsole
Content="&#xE922;" </TextBlock>
FontSize="12" <StackPanel x:Name="TitleBarButtons"
Style="{StaticResource TitleBarButtonStyle}"/> Grid.Column="1"
<Button x:Name="CloseButton" VerticalAlignment="Top"
Click="CloseButton_Click" Orientation="Horizontal">
FontSize="12" <Button x:Name="MinimizeButton"
Style="{StaticResource CloseButtonStyle}"/> Click="MinimizeButton_Click"
</StackPanel> Content="&#xE108;"
</Grid> Style="{StaticResource TitleBarButtonStyle}" />
<ScrollViewer x:Name="TerminalHistoryViewer" Grid.Row="1" ScrollChanged="ScrollViewer_ScrollChanged"> <Button x:Name="MaximizeRestoreButton"
<TextBlock x:Name="TerminalHistoryBlock" FontFamily="Consolas" TextWrapping="Wrap" Foreground="White"/> Click="MaximizeRestoreButton_Click"
</ScrollViewer> Content="&#xE922;"
</Grid> FontSize="12"
</Window> Style="{StaticResource TitleBarButtonStyle}" />
<Button x:Name="CloseButton"
Click="CloseButton_Click"
FontSize="12"
Style="{StaticResource CloseButtonStyle}" />
</StackPanel>
</Grid>
<ScrollViewer x:Name="TerminalHistoryViewer"
Grid.Row="1"
ScrollChanged="ScrollViewer_ScrollChanged">
<TextBlock x:Name="TerminalHistoryBlock"
FontFamily="Consolas"
Foreground="White"
TextWrapping="Wrap" />
</ScrollViewer>
</Grid>
</Window>

View File

@ -1,8 +1,5 @@
<Application <Application x:Class="TestHostApp.App"
x:Class="TestHostApp.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:TestHostApp"
xmlns:local="using:TestHostApp" RequestedTheme="Dark" />
RequestedTheme="Dark">
</Application>

View File

@ -1,52 +1,63 @@
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under <!--
the MIT License. See LICENSE in the project root for license information. --> Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
<Toolkit:XamlApplication the MIT License. See LICENSE in the project root for license information.
x:Class="TerminalApp.App" -->
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" <Toolkit:XamlApplication x:Class="TerminalApp.App"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:local="using:TerminalApp" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Toolkit="using:Microsoft.Toolkit.Win32.UI.XamlHost" xmlns:TA="using:TerminalApp"
xmlns:TA="using:TerminalApp" xmlns:Toolkit="using:Microsoft.Toolkit.Win32.UI.XamlHost"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="using:TerminalApp"
mc:Ignorable="d"> xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
<!-- If you want to prove this works, then add `RequestedTheme="Light"` to mc:Ignorable="d">
the properties on the XamlApplication --> <!--
If you want to prove this works, then add `RequestedTheme="Light"` to
the properties on the XamlApplication
-->
<Toolkit:XamlApplication.Resources> <Toolkit:XamlApplication.Resources>
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>
<!-- Include the MUX Controls resources --> <!-- Include the MUX Controls resources -->
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls"/> <XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
<ResourceDictionary> <ResourceDictionary>
<!-- We're going to apply this style to the root Grid acting <!--
as the tab row, because we need to be able to set its We're going to apply this style to the root Grid acting
`Background` property to "{ThemeResource as the tab row, because we need to be able to set its
ApplicationPageBackgroundThemeBrush}" so it will be colored `Background` property to "{ThemeResource
appropriately for the theme, regardless of what we set the ApplicationPageBackgroundThemeBrush}" so it will be colored
RequestedTheme to --> appropriately for the theme, regardless of what we set the
<Style x:Name="BackgroundGridThemeStyle" TargetType="Grid"> RequestedTheme to
-->
<Style x:Name="BackgroundGridThemeStyle"
TargetType="Grid">
<Setter Property="Background" Value="{ThemeResource ApplicationPageBackgroundThemeBrush}" /> <Setter Property="Background" Value="{ThemeResource ApplicationPageBackgroundThemeBrush}" />
</Style> </Style>
<!-- We need to manually create the error text brush as a <!--
theme-dependent brush. SystemControlErrorTextForegroundBrush We need to manually create the error text brush as a
is unfortunately static. --> theme-dependent brush. SystemControlErrorTextForegroundBrush
<SolidColorBrush x:Name="ErrorTextBrush" Color="{ThemeResource SystemErrorTextColor}" /> is unfortunately static.
-->
<SolidColorBrush x:Name="ErrorTextBrush"
Color="{ThemeResource SystemErrorTextColor}" />
<!-- Suppress all padding except left around the tabs. The TabView looks far better like this. --> <!-- Suppress all padding except left around the tabs. The TabView looks far better like this. -->
<Thickness x:Key="TabViewHeaderPadding">8,0,0,0</Thickness> <Thickness x:Key="TabViewHeaderPadding">8,0,0,0</Thickness>
<ResourceDictionary.ThemeDictionaries> <ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Dark"> <ResourceDictionary x:Key="Dark">
<!-- Define resources for Dark mode here --> <!-- Define resources for Dark mode here -->
<SolidColorBrush x:Key="TabViewBackground" Color="#FF333333" /> <SolidColorBrush x:Key="TabViewBackground"
Color="#FF333333" />
</ResourceDictionary> </ResourceDictionary>
<ResourceDictionary x:Key="Light"> <ResourceDictionary x:Key="Light">
<!-- Define resources for Light mode here --> <!-- Define resources for Light mode here -->
<SolidColorBrush x:Key="TabViewBackground" Color="#FFCCCCCC" /> <SolidColorBrush x:Key="TabViewBackground"
Color="#FFCCCCCC" />
</ResourceDictionary> </ResourceDictionary>
</ResourceDictionary.ThemeDictionaries> </ResourceDictionary.ThemeDictionaries>

View File

@ -1,146 +1,193 @@
<Flyout <Flyout x:Class="TerminalApp.ColorPickupFlyout"
x:Class="TerminalApp.ColorPickupFlyout" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:TerminalApp" xmlns:local="using:TerminalApp"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">
mc:Ignorable="d">
<Flyout.FlyoutPresenterStyle> <Flyout.FlyoutPresenterStyle>
<Style TargetType="FlyoutPresenter"> <Style TargetType="FlyoutPresenter">
<Setter Property="MinWidth" Value="0"/> <Setter Property="MinWidth" Value="0" />
</Style> </Style>
</Flyout.FlyoutPresenterStyle> </Flyout.FlyoutPresenterStyle>
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<StackPanel XYFocusKeyboardNavigation="Enabled"> <StackPanel XYFocusKeyboardNavigation="Enabled">
<VariableSizedWrapGrid Orientation="Horizontal" MaximumRowsOrColumns="4" HorizontalAlignment="Center" Margin="0, 3, 0, 0"> <VariableSizedWrapGrid Margin="0,3,0,0"
HorizontalAlignment="Center"
MaximumRowsOrColumns="4"
Orientation="Horizontal">
<VariableSizedWrapGrid.Resources> <VariableSizedWrapGrid.Resources>
<Style TargetType="Rectangle"> <Style TargetType="Rectangle">
<Setter Property="Width" Value="30"/> <Setter Property="Width" Value="30" />
<Setter Property="Height" Value="30"/> <Setter Property="Height" Value="30" />
</Style> </Style>
<Style TargetType="Button"> <Style TargetType="Button">
<Setter Property="Padding" Value="0"/> <Setter Property="Padding" Value="0" />
<Setter Property="Margin" Value="2"/> <Setter Property="Margin" Value="2" />
</Style> </Style>
</VariableSizedWrapGrid.Resources> </VariableSizedWrapGrid.Resources>
<Button Click="ColorButton_Click" AutomationProperties.Name="Crimson" x:Uid="CrimsonColorButton"> <Button x:Uid="CrimsonColorButton"
AutomationProperties.Name="Crimson"
Click="ColorButton_Click">
<Button.Content> <Button.Content>
<Rectangle Fill="Crimson"/> <Rectangle Fill="Crimson" />
</Button.Content> </Button.Content>
</Button> </Button>
<Button Click="ColorButton_Click" AutomationProperties.Name="SteelBlue" x:Uid="SteelBlueColorButton"> <Button x:Uid="SteelBlueColorButton"
AutomationProperties.Name="SteelBlue"
Click="ColorButton_Click">
<Button.Content> <Button.Content>
<Rectangle Fill="SteelBlue"/> <Rectangle Fill="SteelBlue" />
</Button.Content> </Button.Content>
</Button> </Button>
<Button Click="ColorButton_Click" AutomationProperties.Name="MediumSeaGreen" x:Uid="MediumSeaGreenColorButton"> <Button x:Uid="MediumSeaGreenColorButton"
AutomationProperties.Name="MediumSeaGreen"
Click="ColorButton_Click">
<Button.Content> <Button.Content>
<Rectangle Fill="MediumSeaGreen"/> <Rectangle Fill="MediumSeaGreen" />
</Button.Content> </Button.Content>
</Button> </Button>
<Button Click="ColorButton_Click" AutomationProperties.Name="DarkOrange" x:Uid="DarkOrangeColorButton"> <Button x:Uid="DarkOrangeColorButton"
AutomationProperties.Name="DarkOrange"
Click="ColorButton_Click">
<Button.Content> <Button.Content>
<Rectangle Fill="DarkOrange"/> <Rectangle Fill="DarkOrange" />
</Button.Content> </Button.Content>
</Button> </Button>
<Button Click="ColorButton_Click" AutomationProperties.Name="MediumVioletRed" x:Uid="MediumVioletRedColorButton"> <Button x:Uid="MediumVioletRedColorButton"
AutomationProperties.Name="MediumVioletRed"
Click="ColorButton_Click">
<Button.Content> <Button.Content>
<Rectangle Fill="MediumVioletRed"/> <Rectangle Fill="MediumVioletRed" />
</Button.Content> </Button.Content>
</Button> </Button>
<Button Click="ColorButton_Click" AutomationProperties.Name="DodgerBlue" x:Uid="DodgerBlueColorButton"> <Button x:Uid="DodgerBlueColorButton"
AutomationProperties.Name="DodgerBlue"
Click="ColorButton_Click">
<Button.Content> <Button.Content>
<Rectangle Fill="DodgerBlue"/> <Rectangle Fill="DodgerBlue" />
</Button.Content> </Button.Content>
</Button> </Button>
<Button Click="ColorButton_Click" AutomationProperties.Name="LimeGreen" x:Uid="LimeGreenColorButton"> <Button x:Uid="LimeGreenColorButton"
AutomationProperties.Name="LimeGreen"
Click="ColorButton_Click">
<Button.Content> <Button.Content>
<Rectangle Fill="LimeGreen"/> <Rectangle Fill="LimeGreen" />
</Button.Content> </Button.Content>
</Button> </Button>
<Button Click="ColorButton_Click" AutomationProperties.Name="Yellow" x:Uid="YellowColorButton"> <Button x:Uid="YellowColorButton"
AutomationProperties.Name="Yellow"
Click="ColorButton_Click">
<Button.Content> <Button.Content>
<Rectangle Fill="Yellow"/> <Rectangle Fill="Yellow" />
</Button.Content> </Button.Content>
</Button> </Button>
<Button Click="ColorButton_Click" AutomationProperties.Name="BlueViolet" x:Uid="BlueVioletColorButton"> <Button x:Uid="BlueVioletColorButton"
AutomationProperties.Name="BlueViolet"
Click="ColorButton_Click">
<Button.Content> <Button.Content>
<Rectangle Fill="BlueViolet"/> <Rectangle Fill="BlueViolet" />
</Button.Content> </Button.Content>
</Button> </Button>
<Button Click="ColorButton_Click" AutomationProperties.Name="SlateBlue" x:Uid="SlateBlueColorButton"> <Button x:Uid="SlateBlueColorButton"
AutomationProperties.Name="SlateBlue"
Click="ColorButton_Click">
<Button.Content> <Button.Content>
<Rectangle Fill="SlateBlue"/> <Rectangle Fill="SlateBlue" />
</Button.Content> </Button.Content>
</Button> </Button>
<Button Click="ColorButton_Click" AutomationProperties.Name="Lime" x:Uid="LimeColorButton"> <Button x:Uid="LimeColorButton"
AutomationProperties.Name="Lime"
Click="ColorButton_Click">
<Button.Content> <Button.Content>
<Rectangle Fill="Lime"/> <Rectangle Fill="Lime" />
</Button.Content> </Button.Content>
</Button> </Button>
<Button Click="ColorButton_Click" AutomationProperties.Name="Tan" x:Uid="TanColorButton"> <Button x:Uid="TanColorButton"
AutomationProperties.Name="Tan"
Click="ColorButton_Click">
<Button.Content> <Button.Content>
<Rectangle Fill="Tan"/> <Rectangle Fill="Tan" />
</Button.Content> </Button.Content>
</Button> </Button>
<Button Click="ColorButton_Click" AutomationProperties.Name="Magenta" x:Uid="MagentaColorButton"> <Button x:Uid="MagentaColorButton"
AutomationProperties.Name="Magenta"
Click="ColorButton_Click">
<Button.Content> <Button.Content>
<Rectangle Fill="Magenta"/> <Rectangle Fill="Magenta" />
</Button.Content> </Button.Content>
</Button> </Button>
<Button Click="ColorButton_Click" AutomationProperties.Name="Cyan" x:Uid="CyanColorButton"> <Button x:Uid="CyanColorButton"
AutomationProperties.Name="Cyan"
Click="ColorButton_Click">
<Button.Content> <Button.Content>
<Rectangle Fill="Cyan"/> <Rectangle Fill="Cyan" />
</Button.Content> </Button.Content>
</Button> </Button>
<Button Click="ColorButton_Click" AutomationProperties.Name="SkyBlue" x:Uid="SkyBlueColorButton"> <Button x:Uid="SkyBlueColorButton"
AutomationProperties.Name="SkyBlue"
Click="ColorButton_Click">
<Button.Content> <Button.Content>
<Rectangle Fill="SkyBlue"/> <Rectangle Fill="SkyBlue" />
</Button.Content> </Button.Content>
</Button> </Button>
<Button Click="ColorButton_Click" AutomationProperties.Name="DarkGray" x:Uid="DarkGrayColorButton"> <Button x:Uid="DarkGrayColorButton"
AutomationProperties.Name="DarkGray"
Click="ColorButton_Click">
<Button.Content> <Button.Content>
<Rectangle Fill="DarkGray"/> <Rectangle Fill="DarkGray" />
</Button.Content> </Button.Content>
</Button> </Button>
</VariableSizedWrapGrid> </VariableSizedWrapGrid>
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal"> <StackPanel HorizontalAlignment="Center"
Orientation="Horizontal">
<StackPanel.Resources> <StackPanel.Resources>
<Style TargetType="Button"> <Style TargetType="Button">
<Setter Property="Margin" Value="2" /> <Setter Property="Margin" Value="2" />
<Setter Property="HorizontalAlignment" Value="Stretch" /> <Setter Property="HorizontalAlignment" Value="Stretch" />
</Style> </Style>
</StackPanel.Resources> </StackPanel.Resources>
<Button Padding="5" <Button x:Name="ClearColorButton"
Click="ClearColorButton_Click" x:Uid="TabColorClearButton"
x:Name="ClearColorButton" x:Uid="TabColorClearButton" CornerRadius="2" Content="Reset"> Padding="5"
</Button> Click="ClearColorButton_Click"
<Button Padding="5" Content="Reset"
Click="ShowColorPickerButton_Click" CornerRadius="2" />
x:Name="CustomColorButton" x:Uid="TabColorCustomButton" CornerRadius="2" Content="Custom..."> <Button x:Name="CustomColorButton"
</Button> x:Uid="TabColorCustomButton"
Padding="5"
Click="ShowColorPickerButton_Click"
Content="Custom..."
CornerRadius="2" />
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>
<Grid Visibility="Collapsed" x:Name="customColorPanel" Margin="5"> <Grid x:Name="customColorPanel"
Margin="5"
Visibility="Collapsed">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<ColorPicker x:Name="customColorPicker" <ColorPicker x:Name="customColorPicker"
IsMoreButtonVisible="True" Grid.Row="0"
IsColorSliderVisible="True" ColorChanged="ColorPicker_ColorChanged"
IsColorChannelTextInputVisible="True" FontSize="10"
IsHexInputVisible="True" IsAlphaEnabled="False"
IsAlphaEnabled="False" IsAlphaSliderVisible="False"
IsAlphaSliderVisible="False" IsAlphaTextInputVisible="False"
IsAlphaTextInputVisible="False" IsColorChannelTextInputVisible="True"
FontSize="10" IsColorSliderVisible="True"
Grid.Row="0" IsHexInputVisible="True"
ColorChanged="ColorPicker_ColorChanged" IsMoreButtonVisible="True" />
> <Button x:Name="OkButton"
</ColorPicker> x:Uid="OkButton"
<Button x:Name="OkButton" Click="CustomColorButton_Click" Grid.Row="1" HorizontalAlignment="Center" MinWidth="130" MinHeight="12" Margin="0, 5, 0, 0" x:Uid="OkButton" Content="**OK**"/> Grid.Row="1"
MinWidth="130"
MinHeight="12"
Margin="0,5,0,0"
HorizontalAlignment="Center"
Click="CustomColorButton_Click"
Content="**OK**" />
</Grid> </Grid>
</StackPanel> </StackPanel>
</Flyout> </Flyout>

View File

@ -1,490 +1,500 @@
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under <!--
the MIT License. See LICENSE in the project root for license information. --> Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
<UserControl the MIT License. See LICENSE in the project root for license information.
x:Class="TerminalApp.CommandPalette" -->
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" <UserControl x:Class="TerminalApp.CommandPalette"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:local="using:TerminalApp" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:model="using:Microsoft.Terminal.Settings.Model" xmlns:SettingsModel="using:Microsoft.Terminal.Settings.Model"
xmlns:mux="using:Microsoft.UI.Xaml.Controls" xmlns:Windows10version1903="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 8)"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="using:TerminalApp"
xmlns:Windows10version1903="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 8)" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:SettingsModel="using:Microsoft.Terminal.Settings.Model" xmlns:model="using:Microsoft.Terminal.Settings.Model"
TabNavigation="Cycle" xmlns:mux="using:Microsoft.UI.Xaml.Controls"
IsTabStop="True" AllowFocusOnInteraction="True"
AllowFocusOnInteraction="True" AutomationProperties.Name="{x:Bind ControlName, Mode=OneWay}"
PointerPressed="_rootPointerPressed" IsTabStop="True"
PreviewKeyDown="_previewKeyDownHandler" LostFocus="_lostFocusHandler"
PreviewKeyUp="_keyUpHandler" PointerPressed="_rootPointerPressed"
LostFocus="_lostFocusHandler" PreviewKeyDown="_previewKeyDownHandler"
mc:Ignorable="d" PreviewKeyUp="_keyUpHandler"
AutomationProperties.Name="{x:Bind ControlName, Mode=OneWay}"> TabNavigation="Cycle"
mc:Ignorable="d">
<UserControl.Resources>
<ResourceDictionary> <UserControl.Resources>
<ResourceDictionary>
<!-- ThemeShadow is only on 18362. This "Windows10version1903" bit
adds it conditionally --> <!--
<Windows10version1903:ThemeShadow x:Name="CommandPaletteShadow" /> ThemeShadow is only on 18362. This "Windows10version1903" bit
adds it conditionally
<!-- This creates an instance of our CommandKeyChordVisibilityConverter we can reference below --> -->
<local:EmptyStringVisibilityConverter x:Key="CommandKeyChordVisibilityConverter"/> <Windows10version1903:ThemeShadow x:Name="CommandPaletteShadow" />
<local:EmptyStringVisibilityConverter x:Key="ParsedCommandLineTextVisibilityConverter"/>
<local:EmptyStringVisibilityConverter x:Key="ParentCommandVisibilityConverter"/> <!-- This creates an instance of our CommandKeyChordVisibilityConverter we can reference below -->
<model:IconPathConverter x:Key="IconSourceConverter"/> <local:EmptyStringVisibilityConverter x:Key="CommandKeyChordVisibilityConverter" />
<local:EmptyStringVisibilityConverter x:Key="ParsedCommandLineTextVisibilityConverter" />
<DataTemplate x:Key="ListItemTemplate" x:DataType="local:FilteredCommand"> <local:EmptyStringVisibilityConverter x:Key="ParentCommandVisibilityConverter" />
<ListViewItem HorizontalContentAlignment="Stretch" <model:IconPathConverter x:Key="IconSourceConverter" />
AutomationProperties.Name="{x:Bind Item.Name, Mode=OneWay}"
AutomationProperties.AcceleratorKey="{x:Bind Item.KeyChordText, Mode=OneWay}"/> <DataTemplate x:Key="ListItemTemplate"
</DataTemplate> x:DataType="local:FilteredCommand">
<ListViewItem HorizontalContentAlignment="Stretch"
<DataTemplate x:Key="GeneralItemTemplate" x:DataType="local:FilteredCommand"> AutomationProperties.AcceleratorKey="{x:Bind Item.KeyChordText, Mode=OneWay}"
<Grid HorizontalAlignment="Stretch" ColumnSpacing="8"> AutomationProperties.Name="{x:Bind Item.Name, Mode=OneWay}" />
<Grid.ColumnDefinitions> </DataTemplate>
<ColumnDefinition Width="16"/>
<!-- icon --> <DataTemplate x:Key="GeneralItemTemplate"
<ColumnDefinition Width="Auto"/> x:DataType="local:FilteredCommand">
<!-- command label --> <Grid HorizontalAlignment="Stretch"
<ColumnDefinition Width="*"/> ColumnSpacing="8">
<!-- key chord --> <Grid.ColumnDefinitions>
<ColumnDefinition Width="16"/> <ColumnDefinition Width="16" />
<!-- gutter for scrollbar --> <!-- icon -->
</Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" />
<!-- command label -->
<IconSourceElement <ColumnDefinition Width="*" />
Grid.Column="0" <!-- key chord -->
Width="16" <ColumnDefinition Width="16" />
Height="16" <!-- gutter for scrollbar -->
IconSource="{x:Bind Item.Icon, </Grid.ColumnDefinitions>
Mode=OneWay,
Converter={StaticResource IconSourceConverter}}"/> <IconSourceElement Grid.Column="0"
Width="16"
<local:HighlightedTextControl Height="16"
Grid.Column="1" IconSource="{x:Bind Item.Icon, Mode=OneWay, Converter={StaticResource IconSourceConverter}}" />
HorizontalAlignment="Left"
Text="{x:Bind HighlightedName, Mode=OneWay}"/> <local:HighlightedTextControl Grid.Column="1"
HorizontalAlignment="Left"
<!-- The block for the key chord is only visible Text="{x:Bind HighlightedName, Mode=OneWay}" />
when there's actual text set as the label. See
CommandKeyChordVisibilityConverter for details. <!--
We're setting the accessibility view on the The block for the key chord is only visible
border and text block to Raw because otherwise, when there's actual text set as the label. See
Narrator will read out the key chord. Problem is, CommandKeyChordVisibilityConverter for details.
it already did that because it was the list item's We're setting the accessibility view on the
"AcceleratorKey". It's redundant. --> border and text block to Raw because otherwise,
<Border Narrator will read out the key chord. Problem is,
Grid.Column="2" it already did that because it was the list item's
Visibility="{x:Bind Item.KeyChordText, "AcceleratorKey". It's redundant.
Mode=OneWay, -->
Converter={StaticResource CommandKeyChordVisibilityConverter}}" <Border Grid.Column="2"
Style="{ThemeResource KeyChordBorderStyle}" Padding="2,0,2,0"
Padding="2,0,2,0" HorizontalAlignment="Right"
HorizontalAlignment="Right" VerticalAlignment="Center"
VerticalAlignment="Center" AutomationProperties.AccessibilityView="Raw"
AutomationProperties.AccessibilityView="Raw"> Style="{ThemeResource KeyChordBorderStyle}"
Visibility="{x:Bind Item.KeyChordText, Mode=OneWay, Converter={StaticResource CommandKeyChordVisibilityConverter}}">
<TextBlock
Style="{ThemeResource KeyChordTextBlockStyle}" <TextBlock AutomationProperties.AccessibilityView="Raw"
FontSize="12" FontSize="12"
Text="{x:Bind Item.KeyChordText, Mode=OneWay}" Style="{ThemeResource KeyChordTextBlockStyle}"
AutomationProperties.AccessibilityView="Raw" /> Text="{x:Bind Item.KeyChordText, Mode=OneWay}" />
</Border> </Border>
</Grid> </Grid>
</DataTemplate> </DataTemplate>
<DataTemplate x:Key="NestedItemTemplate" x:DataType="local:FilteredCommand"> <DataTemplate x:Key="NestedItemTemplate"
<Grid HorizontalAlignment="Stretch" ColumnSpacing="8"> x:DataType="local:FilteredCommand">
<Grid.ColumnDefinitions> <Grid HorizontalAlignment="Stretch"
<ColumnDefinition Width="16"/> ColumnSpacing="8">
<!-- icon --> <Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="16" />
<!-- command label --> <!-- icon -->
<ColumnDefinition Width="*"/> <ColumnDefinition Width="Auto" />
<!-- key chord --> <!-- command label -->
<ColumnDefinition Width="16"/> <ColumnDefinition Width="*" />
<!-- gutter for scrollbar --> <!-- key chord -->
</Grid.ColumnDefinitions> <ColumnDefinition Width="16" />
<!-- gutter for scrollbar -->
<IconSourceElement </Grid.ColumnDefinitions>
Grid.Column="0"
Width="16" <IconSourceElement Grid.Column="0"
Height="16" Width="16"
IconSource="{x:Bind Item.Icon, Height="16"
Mode=OneWay, IconSource="{x:Bind Item.Icon, Mode=OneWay, Converter={StaticResource IconSourceConverter}}" />
Converter={StaticResource IconSourceConverter}}"/>
<local:HighlightedTextControl Grid.Column="1"
<local:HighlightedTextControl HorizontalAlignment="Left"
Grid.Column="1" Text="{x:Bind HighlightedName, Mode=OneWay}" />
HorizontalAlignment="Left"
Text="{x:Bind HighlightedName, Mode=OneWay}"/> <!--
The block for the key chord is only visible
<!-- The block for the key chord is only visible when there's actual text set as the label. See
when there's actual text set as the label. See CommandKeyChordVisibilityConverter for details.
CommandKeyChordVisibilityConverter for details. We're setting the accessibility view on the
We're setting the accessibility view on the border and text block to Raw because otherwise,
border and text block to Raw because otherwise, Narrator will read out the key chord. Problem is,
Narrator will read out the key chord. Problem is, it already did that because it was the list item's
it already did that because it was the list item's "AcceleratorKey". It's redundant.
"AcceleratorKey". It's redundant. --> -->
<Border <Border Grid.Column="2"
Grid.Column="2" Padding="2,0,2,0"
Visibility="{x:Bind Item.KeyChordText, HorizontalAlignment="Right"
Mode=OneWay, VerticalAlignment="Center"
Converter={StaticResource CommandKeyChordVisibilityConverter}}" AutomationProperties.AccessibilityView="Raw"
Style="{ThemeResource KeyChordBorderStyle}" Style="{ThemeResource KeyChordBorderStyle}"
Padding="2,0,2,0" Visibility="{x:Bind Item.KeyChordText, Mode=OneWay, Converter={StaticResource CommandKeyChordVisibilityConverter}}">
HorizontalAlignment="Right"
VerticalAlignment="Center" <TextBlock AutomationProperties.AccessibilityView="Raw"
AutomationProperties.AccessibilityView="Raw"> FontSize="12"
Style="{ThemeResource KeyChordTextBlockStyle}"
<TextBlock Text="{x:Bind Item.KeyChordText, Mode=OneWay}" />
Style="{ThemeResource KeyChordTextBlockStyle}" </Border>
FontSize="12"
Text="{x:Bind Item.KeyChordText, Mode=OneWay}" <!-- xE70E is ChevronUp. Rotated 90 degrees, it's _ChevronRight_ -->
AutomationProperties.AccessibilityView="Raw" /> <FontIcon Grid.Column="2"
</Border> HorizontalAlignment="Right"
FontFamily="Segoe MDL2 Assets"
<!-- xE70E is ChevronUp. Rotated 90 degrees, it's _ChevronRight_ --> Glyph="&#xE70E;">
<FontIcon
FontFamily="Segoe MDL2 Assets" <FontIcon.RenderTransform>
Glyph="&#xE70E;" <RotateTransform Angle="90" CenterX="0.5" CenterY="0.5" />
HorizontalAlignment="Right" </FontIcon.RenderTransform>
Grid.Column="2"> </FontIcon>
<FontIcon.RenderTransform> </Grid>
<RotateTransform CenterX="0.5" CenterY="0.5" Angle="90"/> </DataTemplate>
</FontIcon.RenderTransform>
</FontIcon> <DataTemplate x:Key="TabItemTemplate"
x:DataType="local:FilteredCommand">
</Grid> <Grid HorizontalAlignment="Stretch"
</DataTemplate> AutomationProperties.Name="{x:Bind Item.Name, Mode=OneWay}"
ColumnSpacing="8">
<DataTemplate x:Key="TabItemTemplate" x:DataType="local:FilteredCommand"> <Grid.ColumnDefinitions>
<Grid HorizontalAlignment="Stretch" ColumnSpacing="8" AutomationProperties.Name="{x:Bind Item.Name, Mode=OneWay}"> <ColumnDefinition Width="16" />
<Grid.ColumnDefinitions> <!-- icon / progress -->
<ColumnDefinition Width="16"/> <ColumnDefinition Width="Auto" />
<!-- icon / progress --> <!-- command label -->
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="*" />
<!-- command label --> <!-- gutter for indicators -->
<ColumnDefinition Width="*"/> <ColumnDefinition Width="Auto" />
<!-- gutter for indicators --> <!-- Indicators -->
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="16" />
<!-- Indicators --> <!-- gutter for scrollbar -->
<ColumnDefinition Width="16"/> </Grid.ColumnDefinitions>
<!-- gutter for scrollbar -->
</Grid.ColumnDefinitions> <mux:ProgressRing Grid.Column="0"
Width="15"
<mux:ProgressRing Height="15"
Grid.Column="0" MinWidth="0"
IsActive="{x:Bind Item.(local:TabPaletteItem.TabStatus).IsProgressRingActive, Mode=OneWay}" MinHeight="0"
Visibility="{x:Bind Item.(local:TabPaletteItem.TabStatus).IsProgressRingActive, Mode=OneWay}" IsActive="{x:Bind Item.(local:TabPaletteItem.TabStatus).IsProgressRingActive, Mode=OneWay}"
IsIndeterminate="{x:Bind Item.(local:TabPaletteItem.TabStatus).IsProgressRingIndeterminate, Mode=OneWay}" IsIndeterminate="{x:Bind Item.(local:TabPaletteItem.TabStatus).IsProgressRingIndeterminate, Mode=OneWay}"
Value="{x:Bind Item.(local:TabPaletteItem.TabStatus).ProgressValue, Mode=OneWay}" Visibility="{x:Bind Item.(local:TabPaletteItem.TabStatus).IsProgressRingActive, Mode=OneWay}"
MinHeight="0" Value="{x:Bind Item.(local:TabPaletteItem.TabStatus).ProgressValue, Mode=OneWay}" />
MinWidth="0"
Height="15" <IconSourceElement Grid.Column="0"
Width="15"/> Width="16"
Height="16"
<IconSourceElement IconSource="{x:Bind Item.Icon, Mode=OneWay, Converter={StaticResource IconSourceConverter}}" />
Grid.Column="0"
Width="16" <local:HighlightedTextControl Grid.Column="1"
Height="16" HorizontalAlignment="Left"
IconSource="{x:Bind Item.Icon, Text="{x:Bind HighlightedName, Mode=OneWay}" />
Mode=OneWay,
Converter={StaticResource IconSourceConverter}}"/> <StackPanel Grid.Column="2"
HorizontalAlignment="Right"
<local:HighlightedTextControl VerticalAlignment="Center"
Grid.Column="1" Orientation="Horizontal">
HorizontalAlignment="Left"
Text="{x:Bind HighlightedName, Mode=OneWay}"/> <FontIcon Margin="0,0,8,0"
FontFamily="Segoe MDL2 Assets"
<StackPanel FontSize="12"
Grid.Column="2" Glyph="&#xEA8F;"
VerticalAlignment="Center" Visibility="{x:Bind Item.(local:TabPaletteItem.TabStatus).BellIndicator, Mode=OneWay}" />
HorizontalAlignment="Right"
Orientation="Horizontal"> <FontIcon Margin="0,0,8,0"
FontFamily="Segoe MDL2 Assets"
<FontIcon FontSize="12"
FontFamily="Segoe MDL2 Assets" Glyph="&#xE8A3;"
Visibility="{x:Bind Item.(local:TabPaletteItem.TabStatus).BellIndicator, Mode=OneWay}" Visibility="{x:Bind Item.(local:TabPaletteItem.TabStatus).IsPaneZoomed, Mode=OneWay}" />
Glyph="&#xEA8F;"
FontSize="12" <FontIcon x:Name="HeaderLockIcon"
Margin="0,0,8,0"/> Margin="0,0,8,0"
FontFamily="Segoe MDL2 Assets"
<FontIcon FontSize="12"
FontFamily="Segoe MDL2 Assets" Glyph="&#xE72E;"
Visibility="{x:Bind Item.(local:TabPaletteItem.TabStatus).IsPaneZoomed, Mode=OneWay}" Visibility="{x:Bind Item.(local:TabPaletteItem.TabStatus).IsReadOnlyActive, Mode=OneWay}" />
Glyph="&#xE8A3;"
FontSize="12" </StackPanel>
Margin="0,0,8,0"/> </Grid>
</DataTemplate>
<FontIcon x:Name="HeaderLockIcon"
FontFamily="Segoe MDL2 Assets" <local:PaletteItemTemplateSelector x:Key="PaletteItemTemplateSelector"
Visibility="{x:Bind Item.(local:TabPaletteItem.TabStatus).IsReadOnlyActive, Mode=OneWay}" GeneralItemTemplate="{StaticResource GeneralItemTemplate}"
Glyph="&#xE72E;" NestedItemTemplate="{StaticResource NestedItemTemplate}"
FontSize="12" TabItemTemplate="{StaticResource TabItemTemplate}" />
Margin="0,0,8,0"/>
<ResourceDictionary.ThemeDictionaries>
</StackPanel> <ResourceDictionary x:Key="Dark">
</Grid> <Style x:Key="CommandPaletteBackground"
</DataTemplate> TargetType="Grid">
<Setter Property="Background" Value="#333333" />
<local:PaletteItemTemplateSelector x:Key="PaletteItemTemplateSelector" </Style>
TabItemTemplate="{StaticResource TabItemTemplate}" <!-- TextBox colors ! -->
GeneralItemTemplate="{StaticResource GeneralItemTemplate}" <SolidColorBrush x:Key="TextControlBackground"
NestedItemTemplate="{StaticResource NestedItemTemplate}"/> Color="#333333" />
<SolidColorBrush x:Key="TextBoxPlaceholderTextThemeBrush"
<ResourceDictionary.ThemeDictionaries> Color="#B5B5B5" />
<ResourceDictionary x:Key="Dark"> <SolidColorBrush x:Key="TextControlForeground"
<Style x:Key="CommandPaletteBackground" TargetType="Grid"> Color="#B5B5B5" />
<Setter Property="Background" Value="#333333" /> <SolidColorBrush x:Key="TextControlBorderBrush"
</Style> Color="#404040" />
<!-- TextBox colors !--> <SolidColorBrush x:Key="TextControlButtonForeground"
<SolidColorBrush x:Key="TextControlBackground" Color="#333333"/> Color="#B5B5B5" />
<SolidColorBrush x:Key="TextBoxPlaceholderTextThemeBrush" Color="#B5B5B5"/>
<SolidColorBrush x:Key="TextControlForeground" Color="#B5B5B5"/> <SolidColorBrush x:Key="TextControlBackgroundPointerOver"
<SolidColorBrush x:Key="TextControlBorderBrush" Color="#404040"/> Color="#404040" />
<SolidColorBrush x:Key="TextControlButtonForeground" Color="#B5B5B5"/> <SolidColorBrush x:Key="TextControlForegroundPointerOver"
Color="#FFFFFF" />
<SolidColorBrush x:Key="TextControlBackgroundPointerOver" Color="#404040"/> <SolidColorBrush x:Key="TextControlBorderBrushPointerOver"
<SolidColorBrush x:Key="TextControlForegroundPointerOver" Color="#FFFFFF"/> Color="#404040" />
<SolidColorBrush x:Key="TextControlBorderBrushPointerOver" Color="#404040"/> <SolidColorBrush x:Key="TextControlButtonForegroundPointerOver"
<SolidColorBrush x:Key="TextControlButtonForegroundPointerOver" Color="#FF4343"/> Color="#FF4343" />
<SolidColorBrush x:Key="TextControlBackgroundFocused" Color="#333333"/> <SolidColorBrush x:Key="TextControlBackgroundFocused"
<SolidColorBrush x:Key="TextControlForegroundFocused" Color="#FFFFFF"/> Color="#333333" />
<SolidColorBrush x:Key="TextControlBorderBrushFocused" Color="#404040"/> <SolidColorBrush x:Key="TextControlForegroundFocused"
<SolidColorBrush x:Key="TextControlButtonForegroundPressed" Color="#FFFFFF"/> Color="#FFFFFF" />
<SolidColorBrush x:Key="TextControlButtonBackgroundPressed" Color="#FF4343"/> <SolidColorBrush x:Key="TextControlBorderBrushFocused"
Color="#404040" />
<!-- KeyChordText styles --> <SolidColorBrush x:Key="TextControlButtonForegroundPressed"
<Style x:Key="KeyChordBorderStyle" TargetType="Border"> Color="#FFFFFF" />
<Setter Property="BorderThickness" Value="1" /> <SolidColorBrush x:Key="TextControlButtonBackgroundPressed"
<Setter Property="CornerRadius" Value="1" /> Color="#FF4343" />
<Setter Property="Background" Value="{ThemeResource SystemAltMediumLowColor}" />
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" /> <!-- KeyChordText styles -->
</Style> <Style x:Key="KeyChordBorderStyle"
<Style x:Key="KeyChordTextBlockStyle" TargetType="TextBlock"> TargetType="Border">
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" /> <Setter Property="BorderThickness" Value="1" />
</Style> <Setter Property="CornerRadius" Value="1" />
<Setter Property="Background" Value="{ThemeResource SystemAltMediumLowColor}" />
<!-- ParsedCommandLineText styles --> <Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
<Style x:Key="ParsedCommandLineBorderStyle" TargetType="Border"> </Style>
<Setter Property="BorderThickness" Value="1" /> <Style x:Key="KeyChordTextBlockStyle"
<Setter Property="CornerRadius" Value="1" /> TargetType="TextBlock">
<Setter Property="Background" Value="{ThemeResource SystemAltMediumLowColor}" /> <Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" /> </Style>
</Style>
<Style x:Key="ParsedCommandLineTextBlockStyle" TargetType="TextBlock"> <!-- ParsedCommandLineText styles -->
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" /> <Style x:Key="ParsedCommandLineBorderStyle"
</Style> TargetType="Border">
</ResourceDictionary> <Setter Property="BorderThickness" Value="1" />
<ResourceDictionary x:Key="Light"> <Setter Property="CornerRadius" Value="1" />
<Style x:Key="CommandPaletteBackground" TargetType="Grid"> <Setter Property="Background" Value="{ThemeResource SystemAltMediumLowColor}" />
<Setter Property="Background" Value="#CCCCCC" /> <Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
</Style> </Style>
<!-- TextBox colors !--> <Style x:Key="ParsedCommandLineTextBlockStyle"
<SolidColorBrush x:Key="TextControlBackground" Color="#CCCCCC"/> TargetType="TextBlock">
<SolidColorBrush x:Key="TextBoxPlaceholderTextThemeBrush" Color="#636363"/> <Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
<SolidColorBrush x:Key="TextControlBorderBrush" Color="#636363"/> </Style>
<SolidColorBrush x:Key="TextControlButtonForeground" Color="#636363"/> </ResourceDictionary>
<ResourceDictionary x:Key="Light">
<SolidColorBrush x:Key="TextControlBackgroundPointerOver" Color="#DADADA"/> <Style x:Key="CommandPaletteBackground"
<SolidColorBrush x:Key="TextControlBorderBrushPointerOver" Color="#636363"/> TargetType="Grid">
<SolidColorBrush x:Key="TextControlButtonForegroundPointerOver" Color="#FF4343"/> <Setter Property="Background" Value="#CCCCCC" />
</Style>
<SolidColorBrush x:Key="TextControlBackgroundFocused" Color="#CCCCCC"/> <!-- TextBox colors ! -->
<SolidColorBrush x:Key="TextControlBorderBrushFocused" Color="#636363"/> <SolidColorBrush x:Key="TextControlBackground"
<SolidColorBrush x:Key="TextControlButtonForegroundPressed" Color="#FFFFFF"/> Color="#CCCCCC" />
<SolidColorBrush x:Key="TextControlButtonBackgroundPressed" Color="#FF4343"/> <SolidColorBrush x:Key="TextBoxPlaceholderTextThemeBrush"
Color="#636363" />
<!-- KeyChordText styles --> <SolidColorBrush x:Key="TextControlBorderBrush"
<Style x:Key="KeyChordBorderStyle" TargetType="Border"> Color="#636363" />
<Setter Property="BorderThickness" Value="1" /> <SolidColorBrush x:Key="TextControlButtonForeground"
<Setter Property="CornerRadius" Value="1" /> Color="#636363" />
<Setter Property="Background" Value="{ThemeResource SystemAltMediumLowColor}" />
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" /> <SolidColorBrush x:Key="TextControlBackgroundPointerOver"
</Style> Color="#DADADA" />
<Style x:Key="KeyChordTextBlockStyle" TargetType="TextBlock"> <SolidColorBrush x:Key="TextControlBorderBrushPointerOver"
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" /> Color="#636363" />
</Style> <SolidColorBrush x:Key="TextControlButtonForegroundPointerOver"
Color="#FF4343" />
<!-- ParsedCommandLineText styles -->
<Style x:Key="ParsedCommandLineBorderStyle" TargetType="Border"> <SolidColorBrush x:Key="TextControlBackgroundFocused"
<Setter Property="BorderThickness" Value="1" /> Color="#CCCCCC" />
<Setter Property="CornerRadius" Value="1" /> <SolidColorBrush x:Key="TextControlBorderBrushFocused"
<Setter Property="Background" Value="{ThemeResource SystemAltMediumLowColor}" /> Color="#636363" />
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" /> <SolidColorBrush x:Key="TextControlButtonForegroundPressed"
</Style> Color="#FFFFFF" />
<Style x:Key="ParsedCommandLineTextBlockStyle" TargetType="TextBlock"> <SolidColorBrush x:Key="TextControlButtonBackgroundPressed"
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" /> Color="#FF4343" />
</Style>
</ResourceDictionary> <!-- KeyChordText styles -->
<ResourceDictionary x:Key="HighContrast"> <Style x:Key="KeyChordBorderStyle"
<Style x:Key="CommandPaletteBackground" TargetType="Grid"> TargetType="Border">
<Setter Property="Background" Value="{ThemeResource SystemColorWindowColor}" /> <Setter Property="BorderThickness" Value="1" />
</Style> <Setter Property="CornerRadius" Value="1" />
<Setter Property="Background" Value="{ThemeResource SystemAltMediumLowColor}" />
<!-- KeyChordText styles (use XAML defaults for High Contrast theme) --> <Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
<Style x:Key="KeyChordBorderStyle" TargetType="Border"/> </Style>
<Style x:Key="KeyChordTextBlockStyle" TargetType="TextBlock"/> <Style x:Key="KeyChordTextBlockStyle"
TargetType="TextBlock">
<!-- ParsedCommandLineText styles (use XAML defaults for High Contrast theme) --> <Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
<Style x:Key="ParsedCommandLineBorderStyle" TargetType="Border"/> </Style>
<Style x:Key="ParsedCommandLineTextBlockStyle" TargetType="TextBlock"/>
</ResourceDictionary> <!-- ParsedCommandLineText styles -->
</ResourceDictionary.ThemeDictionaries> <Style x:Key="ParsedCommandLineBorderStyle"
</ResourceDictionary> TargetType="Border">
</UserControl.Resources> <Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="1" />
<Grid> <Setter Property="Background" Value="{ThemeResource SystemAltMediumLowColor}" />
<Grid.ColumnDefinitions> <Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
<ColumnDefinition Width="2*" /> </Style>
<ColumnDefinition Width="6*" /> <Style x:Key="ParsedCommandLineTextBlockStyle"
<ColumnDefinition Width="2*" /> TargetType="TextBlock">
</Grid.ColumnDefinitions> <Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
</Style>
<Grid.RowDefinitions> </ResourceDictionary>
<RowDefinition Height="8*"/> <ResourceDictionary x:Key="HighContrast">
<RowDefinition Height="2*"/> <Style x:Key="CommandPaletteBackground"
</Grid.RowDefinitions> TargetType="Grid">
<Setter Property="Background" Value="{ThemeResource SystemColorWindowColor}" />
<!-- Setting the row/col span of this shadow backdrop is a bit of a hack. In </Style>
order to receive pointer events, an element needs to be _not_ transparent.
However, we want to be able to eat all the clicks outside the immediate <!-- KeyChordText styles (use XAML defaults for High Contrast theme) -->
bounds of the command palette, and we don't want a semi-transparent overlay <Style x:Key="KeyChordBorderStyle"
over all of the UI. Fortunately, if we make this _shadowBackdrop the size of TargetType="Border" />
the entire page, then it can be mostly transparent, and cause the root grid <Style x:Key="KeyChordTextBlockStyle"
to receive clicks _anywhere_ in its bounds. --> TargetType="TextBlock" />
<Grid <!-- ParsedCommandLineText styles (use XAML defaults for High Contrast theme) -->
x:Name="_shadowBackdrop" <Style x:Key="ParsedCommandLineBorderStyle"
Background="Transparent" TargetType="Border" />
Grid.Column="0" <Style x:Key="ParsedCommandLineTextBlockStyle"
Grid.Row="0" TargetType="TextBlock" />
Grid.ColumnSpan="3" </ResourceDictionary>
Grid.RowSpan="2" </ResourceDictionary.ThemeDictionaries>
HorizontalAlignment="Stretch" </ResourceDictionary>
VerticalAlignment="Stretch"> </UserControl.Resources>
</Grid>
<Grid>
<Grid <Grid.ColumnDefinitions>
x:Name="_backdrop" <ColumnDefinition Width="2*" />
Style="{ThemeResource CommandPaletteBackground}" <ColumnDefinition Width="6*" />
CornerRadius="{ThemeResource ControlCornerRadius}" <ColumnDefinition Width="2*" />
PointerPressed="_backdropPointerPressed" </Grid.ColumnDefinitions>
Margin="8"
Grid.Column="1" <Grid.RowDefinitions>
Grid.Row="0" <RowDefinition Height="8*" />
Windows10version1903:Shadow="{StaticResource CommandPaletteShadow}" <RowDefinition Height="2*" />
HorizontalAlignment="Stretch" </Grid.RowDefinitions>
VerticalAlignment="Top">
<!--
<Grid.RowDefinitions> Setting the row/col span of this shadow backdrop is a bit of a hack. In
<RowDefinition Height="Auto"/> order to receive pointer events, an element needs to be _not_ transparent.
<RowDefinition Height="Auto"/> However, we want to be able to eat all the clicks outside the immediate
<RowDefinition Height="*"/> bounds of the command palette, and we don't want a semi-transparent overlay
</Grid.RowDefinitions> over all of the UI. Fortunately, if we make this _shadowBackdrop the size of
the entire page, then it can be mostly transparent, and cause the root grid
<TextBox to receive clicks _anywhere_ in its bounds.
Grid.Row="0" -->
x:Name="_searchBox"
Margin="8" <Grid x:Name="_shadowBackdrop"
Padding="18,8,8,8" Grid.Row="0"
IsSpellCheckEnabled="False" Grid.RowSpan="2"
TextChanged="_filterTextChanged" Grid.Column="0"
PlaceholderText="{x:Bind SearchBoxPlaceholderText, Mode=OneWay}" Grid.ColumnSpan="3"
Text=""> HorizontalAlignment="Stretch"
</TextBox> VerticalAlignment="Stretch"
Background="Transparent" />
<TextBlock
Grid.Row="0" <Grid x:Name="_backdrop"
x:Name="_prefixCharacter" Grid.Row="0"
Margin="16,16,0,-8" Grid.Column="1"
FontSize="14" Margin="8"
HorizontalAlignment="Left" HorizontalAlignment="Stretch"
Visibility="{x:Bind PrefixCharacter, VerticalAlignment="Top"
Mode=OneWay, Windows10version1903:Shadow="{StaticResource CommandPaletteShadow}"
Converter={StaticResource ParentCommandVisibilityConverter}}" CornerRadius="{ThemeResource ControlCornerRadius}"
Text="{x:Bind PrefixCharacter, Mode=OneWay}" PointerPressed="_backdropPointerPressed"
> Style="{ThemeResource CommandPaletteBackground}">
</TextBlock>
<Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" <RowDefinition Height="Auto" />
Padding="16, 0, 16, 4" <RowDefinition Height="Auto" />
Grid.Row="1" <RowDefinition Height="*" />
Visibility="{x:Bind ParentCommandName, </Grid.RowDefinitions>
Mode=OneWay,
Converter={StaticResource ParentCommandVisibilityConverter}}"> <TextBox x:Name="_searchBox"
Grid.Row="0"
<Button Margin="8"
Background="Transparent" Padding="18,8,8,8"
x:Name="_parentCommandBackButton" IsSpellCheckEnabled="False"
x:Uid="ParentCommandBackButton" PlaceholderText="{x:Bind SearchBoxPlaceholderText, Mode=OneWay}"
Click="_moveBackButtonClicked" Text=""
ClickMode="Press" TextChanged="_filterTextChanged" />
VerticalAlignment="Center">
<FontIcon <TextBlock x:Name="_prefixCharacter"
FontSize="12" Grid.Row="0"
FontFamily="Segoe MDL2 Assets" Margin="16,16,0,-8"
Glyph="&#xE76b;"> HorizontalAlignment="Left"
</FontIcon> FontSize="14"
</Button> Text="{x:Bind PrefixCharacter, Mode=OneWay}"
Visibility="{x:Bind PrefixCharacter, Mode=OneWay, Converter={StaticResource ParentCommandVisibilityConverter}}" />
<TextBlock
Padding="16, 0, 16, 4" <StackPanel Grid.Row="1"
x:Name="_parentCommandText" Padding="16,0,16,4"
FontStyle="Italic" Orientation="Horizontal"
Grid.Row="1" Visibility="{x:Bind ParentCommandName, Mode=OneWay, Converter={StaticResource ParentCommandVisibilityConverter}}">
Text="{x:Bind ParentCommandName, Mode=OneWay}"
VerticalAlignment="Center"> <Button x:Name="_parentCommandBackButton"
</TextBlock> x:Uid="ParentCommandBackButton"
</StackPanel> VerticalAlignment="Center"
Background="Transparent"
<TextBlock Click="_moveBackButtonClicked"
Padding="16" ClickMode="Press">
x:Name="_noMatchesText" <FontIcon FontFamily="Segoe MDL2 Assets"
FontStyle="Italic" FontSize="12"
Visibility="Collapsed" Glyph="&#xE76b;" />
Grid.Row="1" </Button>
Text="{x:Bind NoMatchesText, Mode=OneWay}">
</TextBlock> <TextBlock x:Name="_parentCommandText"
Grid.Row="1"
<Border Padding="16,0,16,4"
Grid.Row="1" VerticalAlignment="Center"
Visibility="{x:Bind ParsedCommandLineText, Mode=OneWay, Converter={StaticResource ParsedCommandLineTextVisibilityConverter}}" FontStyle="Italic"
Style="{ThemeResource ParsedCommandLineBorderStyle}" Text="{x:Bind ParentCommandName, Mode=OneWay}" />
Padding="16" </StackPanel>
HorizontalAlignment="Stretch"
VerticalAlignment="Center"> <TextBlock x:Name="_noMatchesText"
Grid.Row="1"
<ScrollViewer MaxHeight="200" VerticalScrollBarVisibility="Auto"> Padding="16"
<TextBlock FontStyle="Italic"
FontStyle="Italic" Text="{x:Bind NoMatchesText, Mode=OneWay}"
TextWrapping="Wrap" Visibility="Collapsed" />
Text="{x:Bind ParsedCommandLineText, Mode=OneWay}"/>
</ScrollViewer> <Border Grid.Row="1"
</Border> Padding="16"
HorizontalAlignment="Stretch"
<ListView VerticalAlignment="Center"
Grid.Row="2" Style="{ThemeResource ParsedCommandLineBorderStyle}"
x:Name="_filteredActionsView" Visibility="{x:Bind ParsedCommandLineText, Mode=OneWay, Converter={StaticResource ParsedCommandLineTextVisibilityConverter}}">
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" <ScrollViewer MaxHeight="200"
SelectionMode="Single" VerticalScrollBarVisibility="Auto">
CanReorderItems="False" <TextBlock FontStyle="Italic"
AllowDrop="False" Text="{x:Bind ParsedCommandLineText, Mode=OneWay}"
IsItemClickEnabled="True" TextWrapping="Wrap" />
ItemClick="_listItemClicked" </ScrollViewer>
ChoosingItemContainer="_choosingItemContainer" </Border>
ContainerContentChanging="_containerContentChanging"
ItemsSource="{x:Bind FilteredActions}"> <ListView x:Name="_filteredActionsView"
</ListView> Grid.Row="2"
HorizontalAlignment="Stretch"
</Grid> VerticalAlignment="Stretch"
AllowDrop="False"
CanReorderItems="False"
</Grid> ChoosingItemContainer="_choosingItemContainer"
</UserControl> ContainerContentChanging="_containerContentChanging"
IsItemClickEnabled="True"
ItemClick="_listItemClicked"
ItemsSource="{x:Bind FilteredActions}"
SelectionMode="Single" />
</Grid>
</Grid>
</UserControl>

View File

@ -1,13 +1,11 @@
<UserControl <UserControl x:Class="TerminalApp.HighlightedTextControl"
x:Class="TerminalApp.HighlightedTextControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:TerminalApp" xmlns:local="using:TerminalApp"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" Background="Transparent"
mc:Ignorable="d" mc:Ignorable="d">
Background="Transparent">
<TextBlock <TextBlock x:Name="_textView" />
x:Name="_textView"/>
</UserControl> </UserControl>

View File

@ -1,86 +1,129 @@
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under <!--
the MIT License. See LICENSE in the project root for license information. --> Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
<StackPanel the MIT License. See LICENSE in the project root for license information.
x:Class="TerminalApp.MinMaxCloseControl" -->
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" <StackPanel x:Class="TerminalApp.MinMaxCloseControl"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Background="Transparent" HorizontalAlignment="Left"
HorizontalAlignment="Left" VerticalAlignment="Top"
VerticalAlignment="Top" d:DesignHeight="36"
Orientation="Horizontal" d:DesignWidth="400"
d:DesignHeight="36" Background="Transparent"
d:DesignWidth="400"> Orientation="Horizontal"
mc:Ignorable="d">
<StackPanel.Resources> <StackPanel.Resources>
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.ThemeDictionaries> <ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Light"> <ResourceDictionary x:Key="Light">
<x:Double x:Key="CaptionButtonStrokeWidth">1.0</x:Double> <x:Double x:Key="CaptionButtonStrokeWidth">1.0</x:Double>
<StaticResource x:Key="CaptionButtonBackgroundPointerOver" ResourceKey="SystemControlBackgroundBaseLowBrush"/> <StaticResource x:Key="CaptionButtonBackgroundPointerOver"
<StaticResource x:Key="CaptionButtonBackgroundPressed" ResourceKey="SystemControlBackgroundBaseMediumLowBrush"/> ResourceKey="SystemControlBackgroundBaseLowBrush" />
<StaticResource x:Key="CaptionButtonStroke" ResourceKey="SystemControlForegroundBaseHighBrush"/> <StaticResource x:Key="CaptionButtonBackgroundPressed"
<StaticResource x:Key="CaptionButtonStrokeColor" ResourceKey="SystemBaseHighColor"/> ResourceKey="SystemControlBackgroundBaseMediumLowBrush" />
<StaticResource x:Key="CaptionButtonStrokePointerOver" ResourceKey="SystemControlForegroundBaseHighBrush"/> <StaticResource x:Key="CaptionButtonStroke"
<StaticResource x:Key="CaptionButtonStrokePressed" ResourceKey="SystemControlForegroundBaseHighBrush"/> ResourceKey="SystemControlForegroundBaseHighBrush" />
<SolidColorBrush x:Key="CaptionButtonBackground" Color="Transparent" /> <StaticResource x:Key="CaptionButtonStrokeColor"
ResourceKey="SystemBaseHighColor" />
<StaticResource x:Key="CaptionButtonStrokePointerOver"
ResourceKey="SystemControlForegroundBaseHighBrush" />
<StaticResource x:Key="CaptionButtonStrokePressed"
ResourceKey="SystemControlForegroundBaseHighBrush" />
<SolidColorBrush x:Key="CaptionButtonBackground"
Color="Transparent" />
<Color x:Key="CaptionButtonBackgroundColor">Transparent</Color> <Color x:Key="CaptionButtonBackgroundColor">Transparent</Color>
<SolidColorBrush x:Key="CloseButtonBackgroundPointerOver" Color="#e81123"/> <SolidColorBrush x:Key="CloseButtonBackgroundPointerOver"
<SolidColorBrush x:Key="CloseButtonStrokePointerOver" Color="White"/> Color="#e81123" />
<SolidColorBrush x:Key="CloseButtonBackgroundPressed" Color="#f1707a"/> <SolidColorBrush x:Key="CloseButtonStrokePointerOver"
<SolidColorBrush x:Key="CloseButtonStrokePressed" Color="Black"/> Color="White" />
<SolidColorBrush x:Key="CloseButtonBackgroundPressed"
Color="#f1707a" />
<SolidColorBrush x:Key="CloseButtonStrokePressed"
Color="Black" />
</ResourceDictionary> </ResourceDictionary>
<ResourceDictionary x:Key="Dark"> <ResourceDictionary x:Key="Dark">
<x:Double x:Key="CaptionButtonStrokeWidth">1.0</x:Double> <x:Double x:Key="CaptionButtonStrokeWidth">1.0</x:Double>
<StaticResource x:Key="CaptionButtonBackgroundPointerOver" ResourceKey="SystemControlBackgroundBaseLowBrush"/> <StaticResource x:Key="CaptionButtonBackgroundPointerOver"
<StaticResource x:Key="CaptionButtonBackgroundPressed" ResourceKey="SystemControlBackgroundBaseMediumLowBrush"/> ResourceKey="SystemControlBackgroundBaseLowBrush" />
<StaticResource x:Key="CaptionButtonStroke" ResourceKey="SystemControlForegroundBaseHighBrush"/> <StaticResource x:Key="CaptionButtonBackgroundPressed"
<StaticResource x:Key="CaptionButtonStrokeColor" ResourceKey="SystemBaseHighColor"/> ResourceKey="SystemControlBackgroundBaseMediumLowBrush" />
<StaticResource x:Key="CaptionButtonStrokePointerOver" ResourceKey="SystemControlForegroundBaseHighBrush"/> <StaticResource x:Key="CaptionButtonStroke"
<StaticResource x:Key="CaptionButtonStrokePressed" ResourceKey="SystemControlForegroundBaseHighBrush"/> ResourceKey="SystemControlForegroundBaseHighBrush" />
<SolidColorBrush x:Key="CaptionButtonBackground" Color="Transparent" /> <StaticResource x:Key="CaptionButtonStrokeColor"
ResourceKey="SystemBaseHighColor" />
<StaticResource x:Key="CaptionButtonStrokePointerOver"
ResourceKey="SystemControlForegroundBaseHighBrush" />
<StaticResource x:Key="CaptionButtonStrokePressed"
ResourceKey="SystemControlForegroundBaseHighBrush" />
<SolidColorBrush x:Key="CaptionButtonBackground"
Color="Transparent" />
<Color x:Key="CaptionButtonBackgroundColor">Transparent</Color> <Color x:Key="CaptionButtonBackgroundColor">Transparent</Color>
<SolidColorBrush x:Key="CloseButtonBackgroundPointerOver" Color="#e81123"/> <SolidColorBrush x:Key="CloseButtonBackgroundPointerOver"
<SolidColorBrush x:Key="CloseButtonStrokePointerOver" Color="White"/> Color="#e81123" />
<SolidColorBrush x:Key="CloseButtonBackgroundPressed" Color="#f1707a"/> <SolidColorBrush x:Key="CloseButtonStrokePointerOver"
<SolidColorBrush x:Key="CloseButtonStrokePressed" Color="Black"/> Color="White" />
<SolidColorBrush x:Key="CloseButtonBackgroundPressed"
Color="#f1707a" />
<SolidColorBrush x:Key="CloseButtonStrokePressed"
Color="Black" />
</ResourceDictionary> </ResourceDictionary>
<ResourceDictionary x:Key="HighContrast"> <ResourceDictionary x:Key="HighContrast">
<x:Double x:Key="CaptionButtonStrokeWidth">3.0</x:Double> <x:Double x:Key="CaptionButtonStrokeWidth">3.0</x:Double>
<SolidColorBrush x:Key="CaptionButtonBackground" Color="{ThemeResource SystemColorButtonFaceColor}"/> <SolidColorBrush x:Key="CaptionButtonBackground"
<StaticResource x:Key="CaptionButtonBackgroundColor" ResourceKey="SystemColorButtonFaceColor"/> Color="{ThemeResource SystemColorButtonFaceColor}" />
<SolidColorBrush x:Key="CaptionButtonBackgroundPointerOver" Color="{ThemeResource SystemColorHighlightColor}"/> <StaticResource x:Key="CaptionButtonBackgroundColor"
<SolidColorBrush x:Key="CaptionButtonBackgroundPressed" Color="{ThemeResource SystemColorHighlightColor}"/> ResourceKey="SystemColorButtonFaceColor" />
<SolidColorBrush x:Key="CaptionButtonStroke" Color="{ThemeResource SystemColorButtonTextColor}"/> <SolidColorBrush x:Key="CaptionButtonBackgroundPointerOver"
<StaticResource x:Key="CaptionButtonStrokeColor" ResourceKey="SystemColorButtonTextColor"/> Color="{ThemeResource SystemColorHighlightColor}" />
<SolidColorBrush x:Key="CaptionButtonStrokePointerOver" Color="{ThemeResource SystemColorHighlightTextColor}"/> <SolidColorBrush x:Key="CaptionButtonBackgroundPressed"
<SolidColorBrush x:Key="CaptionButtonStrokePressed" Color="{ThemeResource SystemColorHighlightTextColor}"/> Color="{ThemeResource SystemColorHighlightColor}" />
<SolidColorBrush x:Key="CloseButtonBackgroundPointerOver" Color="{ThemeResource SystemColorHighlightColor}"/> <SolidColorBrush x:Key="CaptionButtonStroke"
<SolidColorBrush x:Key="CloseButtonStrokePointerOver" Color="{ThemeResource SystemColorHighlightTextColor}"/> Color="{ThemeResource SystemColorButtonTextColor}" />
<SolidColorBrush x:Key="CloseButtonBackgroundPressed" Color="{ThemeResource SystemColorHighlightColor}"/> <StaticResource x:Key="CaptionButtonStrokeColor"
<SolidColorBrush x:Key="CloseButtonStrokePressed" Color="{ThemeResource SystemColorHighlightTextColor}"/> ResourceKey="SystemColorButtonTextColor" />
<SolidColorBrush x:Key="CaptionButtonStrokePointerOver"
Color="{ThemeResource SystemColorHighlightTextColor}" />
<SolidColorBrush x:Key="CaptionButtonStrokePressed"
Color="{ThemeResource SystemColorHighlightTextColor}" />
<SolidColorBrush x:Key="CloseButtonBackgroundPointerOver"
Color="{ThemeResource SystemColorHighlightColor}" />
<SolidColorBrush x:Key="CloseButtonStrokePointerOver"
Color="{ThemeResource SystemColorHighlightTextColor}" />
<SolidColorBrush x:Key="CloseButtonBackgroundPressed"
Color="{ThemeResource SystemColorHighlightColor}" />
<SolidColorBrush x:Key="CloseButtonStrokePressed"
Color="{ThemeResource SystemColorHighlightTextColor}" />
</ResourceDictionary> </ResourceDictionary>
</ResourceDictionary.ThemeDictionaries> </ResourceDictionary.ThemeDictionaries>
<x:String x:Key="CaptionButtonPath"></x:String> <!--
<x:String x:Key="CaptionButtonPathWindowMaximized"></x:String> These strings need to be initialized to something, so they're
just initialized to the path for the close button. Each specific
button should override them as needed.
-->
<x:String x:Key="CaptionButtonPath">M 0 0 L 10 10 M 10 0 L 0 10</x:String>
<x:String x:Key="CaptionButtonPathWindowMaximized">M 0 0 L 10 10 M 10 0 L 0 10</x:String>
<!-- "CaptionButtonHeightWindowed" and <!--
"CaptionButtonHeightMaximized" define the size we should use "CaptionButtonHeightWindowed" and
for the caption buttons height for the windowed and maximized "CaptionButtonHeightMaximized" define the size we should use
states, respectively. for the caption buttons height for the windowed and maximized
states, respectively.
32 was chosen for the Maximized height to match the height of
the TabRowControl. This way, when the window is maximized, the 32 was chosen for the Maximized height to match the height of
tabs will be flush with the top of the window. See GH#2541 for the TabRowControl. This way, when the window is maximized, the
details.--> tabs will be flush with the top of the window. See GH#2541 for
details.
-->
<x:Double x:Key="CaptionButtonHeightWindowed">36.0</x:Double> <x:Double x:Key="CaptionButtonHeightWindowed">36.0</x:Double>
<x:Double x:Key="CaptionButtonHeightMaximized">32.0</x:Double> <x:Double x:Key="CaptionButtonHeightMaximized">32.0</x:Double>
<Style x:Key="CaptionButton" TargetType="Button"> <Style x:Key="CaptionButton"
<Setter Property="BorderThickness" Value="0"/> TargetType="Button">
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Background" Value="{ThemeResource CaptionButtonBackground}" /> <Setter Property="Background" Value="{ThemeResource CaptionButtonBackground}" />
<Setter Property="IsTabStop" Value="False" /> <Setter Property="IsTabStop" Value="False" />
<Setter Property="Template"> <Setter Property="Template">
@ -88,21 +131,38 @@ the MIT License. See LICENSE in the project root for license information. -->
<ControlTemplate TargetType="Button"> <ControlTemplate TargetType="Button">
<Border x:Name="ButtonBaseElement" <Border x:Name="ButtonBaseElement"
Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}"
BackgroundSizing="{TemplateBinding BackgroundSizing}" AutomationProperties.AccessibilityView="Raw"
BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}"
BorderThickness="{TemplateBinding BorderThickness}" BackgroundSizing="{TemplateBinding BackgroundSizing}"
CornerRadius="{TemplateBinding CornerRadius}" BorderBrush="{TemplateBinding BorderBrush}"
Padding="{TemplateBinding Padding}" BorderThickness="{TemplateBinding BorderThickness}"
AutomationProperties.AccessibilityView="Raw"> CornerRadius="{TemplateBinding CornerRadius}">
<Path x:Name="Path"
Width="10"
Height="10"
Data="{ThemeResource CaptionButtonPath}"
Stretch="Fill"
Stroke="{ThemeResource CaptionButtonStroke}"
StrokeEndLineCap="Square"
StrokeStartLineCap="Square"
StrokeThickness="{ThemeResource CaptionButtonStrokeWidth}"
UseLayoutRounding="True" />
<VisualStateManager.VisualStateGroups> <VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates"> <VisualStateGroup x:Name="CommonStates">
<VisualStateGroup.Transitions> <VisualStateGroup.Transitions>
<VisualTransition From="PointerOver" To="Normal"> <VisualTransition From="PointerOver"
To="Normal">
<Storyboard> <Storyboard>
<ColorAnimation Storyboard.TargetName="ButtonBaseElement" Storyboard.TargetProperty="(UIElement.Background).(SolidColorBrush.Color)" To="{ThemeResource CaptionButtonBackgroundColor}" Duration="0:0:0.2"/> <ColorAnimation Storyboard.TargetName="ButtonBaseElement"
<ColorAnimation Storyboard.TargetName="Path" Storyboard.TargetProperty="(UIElement.Stroke).(SolidColorBrush.Color)" To="{ThemeResource CaptionButtonStrokeColor}" Duration="0:0:0.1"/> Storyboard.TargetProperty="(UIElement.Background).(SolidColorBrush.Color)"
To="{ThemeResource CaptionButtonBackgroundColor}"
Duration="0:0:0.2" />
<ColorAnimation Storyboard.TargetName="Path"
Storyboard.TargetProperty="(UIElement.Stroke).(SolidColorBrush.Color)"
To="{ThemeResource CaptionButtonStrokeColor}"
Duration="0:0:0.1" />
</Storyboard> </Storyboard>
</VisualTransition> </VisualTransition>
</VisualStateGroup.Transitions> </VisualStateGroup.Transitions>
@ -142,18 +202,6 @@ the MIT License. See LICENSE in the project root for license information. -->
</VisualStateGroup> </VisualStateGroup>
</VisualStateManager.VisualStateGroups> </VisualStateManager.VisualStateGroups>
<Path
x:Name="Path"
StrokeThickness="{ThemeResource CaptionButtonStrokeWidth}"
Stroke="{ThemeResource CaptionButtonStroke}"
Data="{ThemeResource CaptionButtonPath}"
Stretch="Fill"
UseLayoutRounding="True"
Width="10"
Height="10"
StrokeEndLineCap="Square"
StrokeStartLineCap="Square" />
</Border> </Border>
</ControlTemplate> </ControlTemplate>
@ -164,24 +212,28 @@ the MIT License. See LICENSE in the project root for license information. -->
</ResourceDictionary> </ResourceDictionary>
</StackPanel.Resources> </StackPanel.Resources>
<Button Height="{StaticResource CaptionButtonHeightWindowed}" MinWidth="46.0" Width="46.0" <Button x:Name="MinimizeButton"
x:Name="MinimizeButton"
x:Uid="WindowMinimizeButton" x:Uid="WindowMinimizeButton"
Style="{StaticResource CaptionButton}" Width="46.0"
Height="{StaticResource CaptionButtonHeightWindowed}"
MinWidth="46.0"
AutomationProperties.AccessibilityView="Raw"
Click="_MinimizeClick" Click="_MinimizeClick"
AutomationProperties.AccessibilityView="Raw"> Style="{StaticResource CaptionButton}">
<Button.Resources> <Button.Resources>
<ResourceDictionary> <ResourceDictionary>
<x:String x:Key="CaptionButtonPath">M 0 0 H 10</x:String> <x:String x:Key="CaptionButtonPath">M 0 0 H 10</x:String>
</ResourceDictionary> </ResourceDictionary>
</Button.Resources> </Button.Resources>
</Button> </Button>
<Button Height="{StaticResource CaptionButtonHeightWindowed}" MinWidth="46.0" Width="46.0" <Button x:Name="MaximizeButton"
x:Name="MaximizeButton"
x:Uid="WindowMaximizeButton" x:Uid="WindowMaximizeButton"
Style="{StaticResource CaptionButton}" Width="46.0"
Height="{StaticResource CaptionButtonHeightWindowed}"
MinWidth="46.0"
AutomationProperties.AccessibilityView="Raw"
Click="_MaximizeClick" Click="_MaximizeClick"
AutomationProperties.AccessibilityView="Raw"> Style="{StaticResource CaptionButton}">
<Button.Resources> <Button.Resources>
<ResourceDictionary> <ResourceDictionary>
<x:String x:Key="CaptionButtonPath">M 0 0 H 10 V 10 H 0 V 0</x:String> <x:String x:Key="CaptionButtonPath">M 0 0 H 10 V 10 H 0 V 0</x:String>
@ -191,37 +243,51 @@ the MIT License. See LICENSE in the project root for license information. -->
<ToolTipService.ToolTip> <ToolTipService.ToolTip>
<ToolTip> <ToolTip>
<TextBlock> <TextBlock>
<Run x:Name="MaximizeToolTip"/> <Run x:Name="MaximizeToolTip" />
</TextBlock> </TextBlock>
</ToolTip> </ToolTip>
</ToolTipService.ToolTip> </ToolTipService.ToolTip>
</Button> </Button>
<Button Height="{StaticResource CaptionButtonHeightWindowed}" MinWidth="46.0" Width="46.0" <Button x:Name="CloseButton"
x:Name="CloseButton"
x:Uid="WindowCloseButton" x:Uid="WindowCloseButton"
Style="{StaticResource CaptionButton}" Width="46.0"
Height="{StaticResource CaptionButtonHeightWindowed}"
MinWidth="46.0"
AutomationProperties.AccessibilityView="Raw"
Click="_CloseClick" Click="_CloseClick"
AutomationProperties.AccessibilityView="Raw"> Style="{StaticResource CaptionButton}">
<Button.Resources> <Button.Resources>
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.ThemeDictionaries> <ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Light"> <ResourceDictionary x:Key="Light">
<StaticResource x:Key="CaptionButtonBackgroundPointerOver" ResourceKey="CloseButtonBackgroundPointerOver"/> <StaticResource x:Key="CaptionButtonBackgroundPointerOver"
<StaticResource x:Key="CaptionButtonBackgroundPressed" ResourceKey="CloseButtonBackgroundPressed"/> ResourceKey="CloseButtonBackgroundPointerOver" />
<StaticResource x:Key="CaptionButtonStrokePointerOver" ResourceKey="CloseButtonStrokePointerOver"/> <StaticResource x:Key="CaptionButtonBackgroundPressed"
<StaticResource x:Key="CaptionButtonStrokePressed" ResourceKey="CloseButtonStrokePressed"/> ResourceKey="CloseButtonBackgroundPressed" />
<StaticResource x:Key="CaptionButtonStrokePointerOver"
ResourceKey="CloseButtonStrokePointerOver" />
<StaticResource x:Key="CaptionButtonStrokePressed"
ResourceKey="CloseButtonStrokePressed" />
</ResourceDictionary> </ResourceDictionary>
<ResourceDictionary x:Key="Dark"> <ResourceDictionary x:Key="Dark">
<StaticResource x:Key="CaptionButtonBackgroundPointerOver" ResourceKey="CloseButtonBackgroundPointerOver"/> <StaticResource x:Key="CaptionButtonBackgroundPointerOver"
<StaticResource x:Key="CaptionButtonBackgroundPressed" ResourceKey="CloseButtonBackgroundPressed"/> ResourceKey="CloseButtonBackgroundPointerOver" />
<StaticResource x:Key="CaptionButtonStrokePointerOver" ResourceKey="CloseButtonStrokePointerOver"/> <StaticResource x:Key="CaptionButtonBackgroundPressed"
<StaticResource x:Key="CaptionButtonStrokePressed" ResourceKey="CloseButtonStrokePressed"/> ResourceKey="CloseButtonBackgroundPressed" />
<StaticResource x:Key="CaptionButtonStrokePointerOver"
ResourceKey="CloseButtonStrokePointerOver" />
<StaticResource x:Key="CaptionButtonStrokePressed"
ResourceKey="CloseButtonStrokePressed" />
</ResourceDictionary> </ResourceDictionary>
<ResourceDictionary x:Key="HighContrast"> <ResourceDictionary x:Key="HighContrast">
<StaticResource x:Key="CaptionButtonBackgroundPointerOver" ResourceKey="CloseButtonBackgroundPointerOver"/> <StaticResource x:Key="CaptionButtonBackgroundPointerOver"
<StaticResource x:Key="CaptionButtonBackgroundPressed" ResourceKey="CloseButtonBackgroundPressed"/> ResourceKey="CloseButtonBackgroundPointerOver" />
<StaticResource x:Key="CaptionButtonStrokePointerOver" ResourceKey="CloseButtonStrokePointerOver"/> <StaticResource x:Key="CaptionButtonBackgroundPressed"
<StaticResource x:Key="CaptionButtonStrokePressed" ResourceKey="CloseButtonStrokePressed"/> ResourceKey="CloseButtonBackgroundPressed" />
<StaticResource x:Key="CaptionButtonStrokePointerOver"
ResourceKey="CloseButtonStrokePointerOver" />
<StaticResource x:Key="CaptionButtonStrokePressed"
ResourceKey="CloseButtonStrokePressed" />
</ResourceDictionary> </ResourceDictionary>
</ResourceDictionary.ThemeDictionaries> </ResourceDictionary.ThemeDictionaries>

View File

@ -1,78 +1,81 @@
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under <!--
the MIT License. See LICENSE in the project root for license information. --> Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
the MIT License. See LICENSE in the project root for license information.
<UserControl -->
x:Class="TerminalApp.TabHeaderControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" <UserControl x:Class="TerminalApp.TabHeaderControl"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:local="using:TerminalApp" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mux="using:Microsoft.UI.Xaml.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="using:TerminalApp"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" xmlns:mux="using:Microsoft.UI.Xaml.Controls"
MinHeight="16"> MinHeight="16"
mc:Ignorable="d">
<UserControl.Resources>
<ResourceDictionary> <UserControl.Resources>
<ResourceDictionary.ThemeDictionaries> <ResourceDictionary>
<ResourceDictionary x:Key="Light"> <ResourceDictionary.ThemeDictionaries>
<Thickness x:Key="TextControlBorderThemeThicknessFocused">0,0,0,1</Thickness> <ResourceDictionary x:Key="Light">
</ResourceDictionary> <Thickness x:Key="TextControlBorderThemeThicknessFocused">0,0,0,1</Thickness>
<ResourceDictionary x:Key="Dark"> </ResourceDictionary>
<Thickness x:Key="TextControlBorderThemeThicknessFocused">0,0,0,1</Thickness> <ResourceDictionary x:Key="Dark">
</ResourceDictionary> <Thickness x:Key="TextControlBorderThemeThicknessFocused">0,0,0,1</Thickness>
<ResourceDictionary x:Key="HighContrast"> </ResourceDictionary>
<Thickness x:Key="TextControlBorderThemeThicknessFocused">0,0,0,1</Thickness> <ResourceDictionary x:Key="HighContrast">
</ResourceDictionary> <Thickness x:Key="TextControlBorderThemeThicknessFocused">0,0,0,1</Thickness>
</ResourceDictionary.ThemeDictionaries> </ResourceDictionary>
</ResourceDictionary> </ResourceDictionary.ThemeDictionaries>
</UserControl.Resources> </ResourceDictionary>
</UserControl.Resources>
<StackPanel x:Name="HeaderStackPanel"
Orientation="Horizontal"> <StackPanel x:Name="HeaderStackPanel"
<mux:ProgressRing x:Name="HeaderProgressRing" Orientation="Horizontal">
IsActive="{x:Bind TabStatus.IsProgressRingActive, Mode=OneWay}" <mux:ProgressRing x:Name="HeaderProgressRing"
Visibility="{x:Bind TabStatus.IsProgressRingActive, Mode=OneWay}" Width="15"
IsIndeterminate="{x:Bind TabStatus.IsProgressRingIndeterminate, Mode=OneWay}" Height="15"
Value="{x:Bind TabStatus.ProgressValue, Mode=OneWay}" MinWidth="0"
MinHeight="0" MinHeight="0"
MinWidth="0" Margin="-7.5,0,8,0"
Height="15" IsActive="{x:Bind TabStatus.IsProgressRingActive, Mode=OneWay}"
Width="15" IsIndeterminate="{x:Bind TabStatus.IsProgressRingIndeterminate, Mode=OneWay}"
Margin="-7.5,0,8,0"/> Visibility="{x:Bind TabStatus.IsProgressRingActive, Mode=OneWay}"
<!--We want the progress ring to 'replace' the tab icon, but we don't have control Value="{x:Bind TabStatus.ProgressValue, Mode=OneWay}" />
over the tab icon here (the tab view item does) - so we hide the tab icon there <!--
and use a negative margin for the progress ring here to put it where the icon would be--> We want the progress ring to 'replace' the tab icon, but we don't have control
over the tab icon here (the tab view item does) - so we hide the tab icon there
and use a negative margin for the progress ring here to put it where the icon would be
-->
<FontIcon x:Name="HeaderBellIndicator" <FontIcon x:Name="HeaderBellIndicator"
Margin="0,0,8,0"
FontFamily="Segoe MDL2 Assets" FontFamily="Segoe MDL2 Assets"
Visibility="{x:Bind TabStatus.BellIndicator, Mode=OneWay}"
Glyph="&#xEA8F;"
FontSize="12" FontSize="12"
Margin="0,0,8,0"/> Glyph="&#xEA8F;"
<FontIcon x:Name="HeaderZoomIcon" Visibility="{x:Bind TabStatus.BellIndicator, Mode=OneWay}" />
FontFamily="Segoe MDL2 Assets" <FontIcon x:Name="HeaderZoomIcon"
Visibility="{x:Bind TabStatus.IsPaneZoomed, Mode=OneWay}" Margin="0,0,8,0"
Glyph="&#xE8A3;" FontFamily="Segoe MDL2 Assets"
FontSize="12" FontSize="12"
Margin="0,0,8,0"/> Glyph="&#xE8A3;"
<FontIcon x:Name="HeaderLockIcon" Visibility="{x:Bind TabStatus.IsPaneZoomed, Mode=OneWay}" />
FontFamily="Segoe MDL2 Assets" <FontIcon x:Name="HeaderLockIcon"
Visibility="{x:Bind TabStatus.IsReadOnlyActive, Mode=OneWay}" Margin="0,0,8,0"
Glyph="&#xE72E;" FontFamily="Segoe MDL2 Assets"
FontSize="12" FontSize="12"
Margin="0,0,8,0"/> Glyph="&#xE72E;"
<TextBlock x:Name="HeaderTextBlock" Visibility="{x:Bind TabStatus.IsReadOnlyActive, Mode=OneWay}" />
Visibility="Visible" <TextBlock x:Name="HeaderTextBlock"
Text="{x:Bind Title, Mode=OneWay}"/> Text="{x:Bind Title, Mode=OneWay}"
<TextBox x:Name="HeaderRenamerTextBox" Visibility="Visible" />
Visibility="Collapsed" <TextBox x:Name="HeaderRenamerTextBox"
MinHeight="0" Height="16"
Padding="4,0,4,0" MinHeight="0"
MaxLength="1024" MaxWidth="{x:Bind RenamerMaxWidth, Mode=OneWay}"
LostFocus="RenameBoxLostFocusHandler" Padding="4,0,4,0"
Height="16" FontSize="12"
FontSize="12" IsSpellCheckEnabled="False"
IsSpellCheckEnabled="False" LostFocus="RenameBoxLostFocusHandler"
MaxWidth="{x:Bind RenamerMaxWidth, Mode=OneWay}"/> MaxLength="1024"
</StackPanel> Visibility="Collapsed" />
</UserControl> </StackPanel>
</UserControl>

View File

@ -1,85 +1,103 @@
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under <!--
the MIT License. See LICENSE in the project root for license information. --> Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
<ContentPresenter the MIT License. See LICENSE in the project root for license information.
x:Class="TerminalApp.TabRowControl" -->
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" <ContentPresenter x:Class="TerminalApp.TabRowControl"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:local="using:TerminalApp" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mux="using:Microsoft.UI.Xaml.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="using:TerminalApp"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"> xmlns:mux="using:Microsoft.UI.Xaml.Controls"
mc:Ignorable="d">
<mux:TabView x:Name="TabView"
VerticalAlignment="Bottom" <mux:TabView x:Name="TabView"
HorizontalContentAlignment="Stretch" VerticalAlignment="Bottom"
IsAddTabButtonVisible="false" HorizontalContentAlignment="Stretch"
TabWidthMode="Equal" AllowDropTabs="True"
CanReorderTabs="True" CanDragTabs="True"
CanDragTabs="True" CanReorderTabs="True"
AllowDropTabs="True"> IsAddTabButtonVisible="false"
TabWidthMode="Equal">
<mux:TabView.TabStripFooter>
<mux:SplitButton <mux:TabView.TabStripFooter>
x:Name="NewTabButton" <mux:SplitButton x:Name="NewTabButton"
x:Uid="NewTabSplitButton" x:Uid="NewTabSplitButton"
Click="OnNewTabButtonClick" HorizontalAlignment="Left"
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
HorizontalAlignment="Left" AutomationProperties.AccessibilityView="Control"
Content="&#xE710;" BorderThickness="0"
UseLayoutRounding="true" Click="OnNewTabButtonClick"
FontFamily="Segoe MDL2 Assets" Content="&#xE710;"
FontWeight="SemiLight" CornerRadius="{Binding Source={ThemeResource OverlayCornerRadius}, Converter={StaticResource TopCornerRadiusFilterConverter}}"
FontSize="12" FontFamily="Segoe MDL2 Assets"
BorderThickness="0" FontSize="12"
CornerRadius="{Binding Source={ThemeResource OverlayCornerRadius}, Converter={StaticResource TopCornerRadiusFilterConverter}}" FontWeight="SemiLight"
AutomationProperties.AccessibilityView="Control"> UseLayoutRounding="true">
<ToolTipService.ToolTip> <ToolTipService.ToolTip>
<ToolTip Placement="Mouse"> <ToolTip Placement="Mouse">
<TextBlock IsTextSelectionEnabled="False"> <TextBlock IsTextSelectionEnabled="False">
<Run x:Uid="NewTabRun"/> <LineBreak/> <Run x:Uid="NewTabRun" /> <LineBreak />
<Run x:Uid="NewPaneRun" <Run x:Uid="NewPaneRun"
FontStyle="Italic"/> <LineBreak/> FontStyle="Italic" /> <LineBreak />
<Run x:Uid="NewWindowRun" <Run x:Uid="NewWindowRun"
FontStyle="Italic"/> FontStyle="Italic" />
</TextBlock> </TextBlock>
</ToolTip> </ToolTip>
</ToolTipService.ToolTip> </ToolTipService.ToolTip>
<!-- U+E710 is the fancy plus icon. --> <!-- U+E710 is the fancy plus icon. -->
<mux:SplitButton.Resources> <mux:SplitButton.Resources>
<!-- Override the SplitButton* resources to match the tab view's button's styles. --> <!-- Override the SplitButton* resources to match the tab view's button's styles. -->
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.ThemeDictionaries> <ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Light"> <ResourceDictionary x:Key="Light">
<StaticResource x:Key="SplitButtonBackground" ResourceKey="TabViewButtonBackground" /> <StaticResource x:Key="SplitButtonBackground"
<StaticResource x:Key="SplitButtonForeground" ResourceKey="TabViewButtonForeground" /> ResourceKey="TabViewButtonBackground" />
<StaticResource x:Key="SplitButtonBackgroundPressed" ResourceKey="TabViewItemHeaderBackgroundPressed" /> <StaticResource x:Key="SplitButtonForeground"
<StaticResource x:Key="SplitButtonForegroundPressed" ResourceKey="TabViewItemHeaderForegroundPressed" /> ResourceKey="TabViewButtonForeground" />
<StaticResource x:Key="SplitButtonBackgroundPointerOver" ResourceKey="TabViewItemHeaderBackgroundPointerOver" /> <StaticResource x:Key="SplitButtonBackgroundPressed"
<StaticResource x:Key="SplitButtonForegroundPointerOver" ResourceKey="TabViewItemHeaderForegroundPointerOver" /> ResourceKey="TabViewItemHeaderBackgroundPressed" />
</ResourceDictionary> <StaticResource x:Key="SplitButtonForegroundPressed"
<ResourceDictionary x:Key="Dark"> ResourceKey="TabViewItemHeaderForegroundPressed" />
<StaticResource x:Key="SplitButtonBackground" ResourceKey="TabViewButtonBackground" /> <StaticResource x:Key="SplitButtonBackgroundPointerOver"
<StaticResource x:Key="SplitButtonForeground" ResourceKey="TabViewButtonForeground" /> ResourceKey="TabViewItemHeaderBackgroundPointerOver" />
<StaticResource x:Key="SplitButtonBackgroundPressed" ResourceKey="TabViewItemHeaderBackgroundPressed" /> <StaticResource x:Key="SplitButtonForegroundPointerOver"
<StaticResource x:Key="SplitButtonForegroundPressed" ResourceKey="TabViewItemHeaderForegroundPressed" /> ResourceKey="TabViewItemHeaderForegroundPointerOver" />
<StaticResource x:Key="SplitButtonBackgroundPointerOver" ResourceKey="TabViewItemHeaderBackgroundPointerOver" /> </ResourceDictionary>
<StaticResource x:Key="SplitButtonForegroundPointerOver" ResourceKey="TabViewItemHeaderForegroundPointerOver" /> <ResourceDictionary x:Key="Dark">
</ResourceDictionary> <StaticResource x:Key="SplitButtonBackground"
<ResourceDictionary x:Key="HighContrast"> ResourceKey="TabViewButtonBackground" />
<StaticResource x:Key="SplitButtonBackground" ResourceKey="TabViewButtonBackground" /> <StaticResource x:Key="SplitButtonForeground"
<StaticResource x:Key="SplitButtonForeground" ResourceKey="TabViewButtonForeground" /> ResourceKey="TabViewButtonForeground" />
<StaticResource x:Key="SplitButtonBackgroundPressed" ResourceKey="TabViewItemHeaderBackgroundPressed" /> <StaticResource x:Key="SplitButtonBackgroundPressed"
<StaticResource x:Key="SplitButtonForegroundPressed" ResourceKey="TabViewItemHeaderForegroundPressed" /> ResourceKey="TabViewItemHeaderBackgroundPressed" />
<StaticResource x:Key="SplitButtonBackgroundPointerOver" ResourceKey="TabViewItemHeaderBackgroundPointerOver" /> <StaticResource x:Key="SplitButtonForegroundPressed"
<StaticResource x:Key="SplitButtonForegroundPointerOver" ResourceKey="TabViewItemHeaderForegroundPointerOver" /> ResourceKey="TabViewItemHeaderForegroundPressed" />
</ResourceDictionary> <StaticResource x:Key="SplitButtonBackgroundPointerOver"
</ResourceDictionary.ThemeDictionaries> ResourceKey="TabViewItemHeaderBackgroundPointerOver" />
</ResourceDictionary> <StaticResource x:Key="SplitButtonForegroundPointerOver"
</mux:SplitButton.Resources> ResourceKey="TabViewItemHeaderForegroundPointerOver" />
</mux:SplitButton> </ResourceDictionary>
</mux:TabView.TabStripFooter> <ResourceDictionary x:Key="HighContrast">
<StaticResource x:Key="SplitButtonBackground"
</mux:TabView> ResourceKey="TabViewButtonBackground" />
<StaticResource x:Key="SplitButtonForeground"
</ContentPresenter> ResourceKey="TabViewButtonForeground" />
<StaticResource x:Key="SplitButtonBackgroundPressed"
ResourceKey="TabViewItemHeaderBackgroundPressed" />
<StaticResource x:Key="SplitButtonForegroundPressed"
ResourceKey="TabViewItemHeaderForegroundPressed" />
<StaticResource x:Key="SplitButtonBackgroundPointerOver"
ResourceKey="TabViewItemHeaderBackgroundPointerOver" />
<StaticResource x:Key="SplitButtonForegroundPointerOver"
ResourceKey="TabViewItemHeaderForegroundPointerOver" />
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>
</mux:SplitButton.Resources>
</mux:SplitButton>
</mux:TabView.TabStripFooter>
</mux:TabView>
</ContentPresenter>

View File

@ -1,136 +1,120 @@
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under <!--
the MIT License. See LICENSE in the project root for license information. --> Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
<Page the MIT License. See LICENSE in the project root for license information.
x:Class="TerminalApp.TerminalPage" -->
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" <Page x:Class="TerminalApp.TerminalPage"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:local="using:TerminalApp" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mux="using:Microsoft.UI.Xaml.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="using:TerminalApp"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"> xmlns:mux="using:Microsoft.UI.Xaml.Controls"
mc:Ignorable="d">
<Grid x:Name="Root" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid.RowDefinitions> <Grid x:Name="Root"
<RowDefinition Height="Auto" /> Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<RowDefinition Height="*" /> <Grid.RowDefinitions>
</Grid.RowDefinitions> <RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<local:TabRowControl x:Name="TabRow" Grid.Row="0" /> </Grid.RowDefinitions>
<Grid x:Name="TabContent" Grid.Row="1" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" /> <local:TabRowControl x:Name="TabRow"
Grid.Row="0" />
<ContentDialog
x:Load="False" <Grid x:Name="TabContent"
x:Name="AboutDialog" Grid.Row="1"
x:Uid="AboutDialog" HorizontalAlignment="Stretch"
DefaultButton="Close"> VerticalAlignment="Stretch" />
<StackPanel Orientation="Vertical">
<TextBlock IsTextSelectionEnabled="True"> <ContentDialog x:Name="AboutDialog"
<Run Text="{x:Bind ApplicationDisplayName}" /> <LineBreak /> x:Uid="AboutDialog"
<Run x:Uid="AboutDialog_VersionLabel" /> x:Load="False"
<Run Text="{x:Bind ApplicationVersion}" /> DefaultButton="Close">
</TextBlock> <StackPanel Orientation="Vertical">
<HyperlinkButton <TextBlock IsTextSelectionEnabled="True">
x:Uid="AboutDialog_DocumentationLink" <Run Text="{x:Bind ApplicationDisplayName}" /> <LineBreak />
NavigateUri="https://go.microsoft.com/fwlink/?linkid=2125416" /> <Run x:Uid="AboutDialog_VersionLabel" />
<HyperlinkButton <Run Text="{x:Bind ApplicationVersion}" />
x:Uid="AboutDialog_ReleaseNotesLink" </TextBlock>
NavigateUri="https://go.microsoft.com/fwlink/?linkid=2125417" /> <HyperlinkButton x:Uid="AboutDialog_DocumentationLink"
<HyperlinkButton NavigateUri="https://go.microsoft.com/fwlink/?linkid=2125416" />
x:Uid="AboutDialog_PrivacyPolicyLink" <HyperlinkButton x:Uid="AboutDialog_ReleaseNotesLink"
NavigateUri="https://go.microsoft.com/fwlink/?linkid=2125418" /> NavigateUri="https://go.microsoft.com/fwlink/?linkid=2125417" />
<HyperlinkButton <HyperlinkButton x:Uid="AboutDialog_PrivacyPolicyLink"
x:Uid="AboutDialog_ThirdPartyNoticesLink" NavigateUri="https://go.microsoft.com/fwlink/?linkid=2125418" />
Click="_ThirdPartyNoticesOnClick" /> <HyperlinkButton x:Uid="AboutDialog_ThirdPartyNoticesLink"
</StackPanel> Click="_ThirdPartyNoticesOnClick" />
</ContentDialog> </StackPanel>
</ContentDialog>
<ContentDialog
x:Load="False" <ContentDialog x:Name="CloseAllDialog"
x:Name="CloseAllDialog" x:Uid="CloseAllDialog"
x:Uid="CloseAllDialog" x:Load="False"
DefaultButton="Primary"> DefaultButton="Primary" />
</ContentDialog>
<ContentDialog x:Name="CloseReadOnlyDialog"
<ContentDialog x:Uid="CloseReadOnlyDialog"
x:Load="False" x:Load="False"
x:Name="CloseReadOnlyDialog" DefaultButton="Close" />
x:Uid="CloseReadOnlyDialog"
DefaultButton="Close"> <ContentDialog x:Name="MultiLinePasteDialog"
</ContentDialog> x:Uid="MultiLinePasteDialog"
x:Load="False"
<ContentDialog DefaultButton="Primary">
x:Load="False" <StackPanel>
x:Name="MultiLinePasteDialog" <TextBlock x:Uid="MultiLineWarningText"
x:Uid="MultiLinePasteDialog" TextWrapping="Wrap" />
DefaultButton="Primary"> <TextBlock x:Uid="ClipboardTextHeader"
<StackPanel> Margin="0,16,0,0" />
<TextBlock <ScrollViewer x:Name="ClipboardContentScrollViewer"
x:Uid="MultiLineWarningText" MaxHeight="100"
TextWrapping="Wrap"> Margin="0,8,0,0">
</TextBlock> <TextBlock x:Name="ClipboardText"
<TextBlock FontFamily="Cascadia Mono"
x:Uid="ClipboardTextHeader" TextWrapping="Wrap" />
Margin="0,16,0,0"> </ScrollViewer>
</TextBlock> </StackPanel>
<ScrollViewer </ContentDialog>
Margin="0,8,0,0"
x:Name="ClipboardContentScrollViewer" <ContentDialog x:Name="LargePasteDialog"
MaxHeight="100"> x:Uid="LargePasteDialog"
<TextBlock x:Load="False"
x:Name="ClipboardText" DefaultButton="Primary" />
TextWrapping="Wrap"
FontFamily="Cascadia Mono"> <ContentDialog x:Name="ControlNoticeDialog"
</TextBlock> x:Uid="ControlNoticeDialog"
</ScrollViewer> x:Load="False"
</StackPanel> DefaultButton="Primary">
</ContentDialog> <TextBlock IsTextSelectionEnabled="True"
TextWrapping="WrapWholeWords">
<ContentDialog <Run x:Name="NoticeMessage" />
x:Load="False" </TextBlock>
x:Name="LargePasteDialog" </ContentDialog>
x:Uid="LargePasteDialog"
DefaultButton="Primary"> <ContentDialog x:Name="CouldNotOpenUriDialog"
</ContentDialog> x:Uid="CouldNotOpenUriDialog"
x:Load="False"
<ContentDialog DefaultButton="Primary">
x:Load="False" <TextBlock IsTextSelectionEnabled="True"
x:Name="ControlNoticeDialog" TextWrapping="WrapWholeWords">
x:Uid="ControlNoticeDialog" <Run x:Name="CouldNotOpenUriReason" /> <LineBreak />
DefaultButton="Primary"> <Run x:Name="UnopenedUri"
<TextBlock IsTextSelectionEnabled="True" TextWrapping="WrapWholeWords"> FontFamily="Cascadia Mono" />
<Run x:Name="NoticeMessage"/> </TextBlock>
</TextBlock> </ContentDialog>
</ContentDialog>
<local:CommandPalette x:Name="CommandPalette"
<ContentDialog Grid.Row="1"
x:Load="False" VerticalAlignment="Stretch"
x:Name="CouldNotOpenUriDialog" PreviewKeyDown="_KeyDownHandler"
x:Uid="CouldNotOpenUriDialog" Visibility="Collapsed" />
DefaultButton="Primary">
<TextBlock IsTextSelectionEnabled="True" TextWrapping="WrapWholeWords"> <mux:InfoBar x:Name="KeyboardWarningInfoBar"
<Run x:Name="CouldNotOpenUriReason" /> <LineBreak /> x:Load="False"
<Run IsClosable="True"
x:Name="UnopenedUri" IsIconVisible="True"
FontFamily="Cascadia Mono"> IsOpen="False"
</Run> Message="{x:Bind KeyboardServiceDisabledText, Mode=OneWay}"
</TextBlock> Severity="Warning" />
</ContentDialog> </Grid>
</Page>
<local:CommandPalette
x:Name="CommandPalette"
Grid.Row="1"
Visibility="Collapsed"
PreviewKeyDown ="_KeyDownHandler"
VerticalAlignment="Stretch" />
<mux:InfoBar x:Name="KeyboardWarningInfoBar"
x:Load="False"
IsClosable="True"
IsIconVisible="True"
IsOpen="False"
Severity="Warning"
Message="{x:Bind KeyboardServiceDisabledText, Mode=OneWay}"/>
</Grid>
</Page>

View File

@ -1,45 +1,47 @@
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under <!--
the MIT License. See LICENSE in the project root for license information. --> Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
<Grid the MIT License. See LICENSE in the project root for license information.
x:Class="TerminalApp.TitlebarControl" -->
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" <Grid x:Class="TerminalApp.TitlebarControl"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:local="using:TerminalApp" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="using:TerminalApp"
mc:Ignorable="d" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Name="Root" x:Name="Root"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
VerticalAlignment="Top" VerticalAlignment="Top"
SizeChanged="Root_SizeChanged" d:DesignHeight="36"
d:DesignHeight="36" d:DesignWidth="400"
Background="{ThemeResource TabViewBackground}" Background="{ThemeResource TabViewBackground}"
d:DesignWidth="400"> SizeChanged="Root_SizeChanged"
mc:Ignorable="d">
<!-- TODO:GH#1988 <!--
This xaml should probably be a template thing, where the background is a TODO:GH#1988
resource that the app hosting this control can override. Then, it App.xaml, This xaml should probably be a template thing, where the background is a
we'd make sure to set the resource for our background to the appropriate resource that the app hosting this control can override. Then, it App.xaml,
color. SystemControlForegroundAccentBrush also works nicely, to use the we'd make sure to set the resource for our background to the appropriate
accent color. (which is GH#1963)--> color. SystemControlForegroundAccentBrush also works nicely, to use the
accent color. (which is GH#1963)
-->
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<ContentPresenter x:Name="ContentRoot" Grid.Column="0" /> <ContentPresenter x:Name="ContentRoot"
Grid.Column="0" />
<Border <Border x:Name="DragBar"
x:Name="DragBar" Grid.Column="1"
Grid.Column="1" MinWidth="45.0"
MinWidth="45.0" DoubleTapped="DragBar_DoubleTapped" />
DoubleTapped="DragBar_DoubleTapped"/>
<local:MinMaxCloseControl <local:MinMaxCloseControl x:Name="MinMaxCloseControl"
Grid.Column="2" Grid.Column="2"
x:Name="MinMaxCloseControl" HorizontalAlignment="Right" />
HorizontalAlignment="Right" />
</Grid> </Grid>

View File

@ -1,149 +1,225 @@
<UserControl <UserControl x:Class="Microsoft.Terminal.Control.SearchBoxControl"
x:Class="Microsoft.Terminal.Control.SearchBoxControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="using:Microsoft.Terminal.Control"
xmlns:local="using:Microsoft.Terminal.Control" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" x:Name="Root"
mc:Ignorable="d" HorizontalAlignment="Stretch"
x:Name="Root" VerticalAlignment="Top"
HorizontalAlignment="Stretch" d:DesignHeight="55"
VerticalAlignment="Top" d:DesignWidth="285"
d:DesignHeight="55" TabNavigation="Cycle"
d:DesignWidth="285" mc:Ignorable="d">
TabNavigation="Cycle">
<UserControl.Resources> <UserControl.Resources>
<ResourceDictionary> <ResourceDictionary>
<Style x:Key="ToggleButtonStyle" TargetType="ToggleButton"> <Style x:Key="ToggleButtonStyle"
TargetType="ToggleButton">
<Setter Property="Width" Value="25" /> <Setter Property="Width" Value="25" />
<Setter Property="Height" Value="25" /> <Setter Property="Height" Value="25" />
<Setter Property="Background" Value="Transparent" /> <Setter Property="Background" Value="Transparent" />
<Setter Property="Padding" Value="1" /> <Setter Property="Padding" Value="1" />
<Setter Property="CornerRadius" Value="2"/> <Setter Property="CornerRadius" Value="2" />
</Style> </Style>
<Style x:Key="ButtonStyle" TargetType="Button"> <Style x:Key="ButtonStyle"
TargetType="Button">
<Setter Property="Width" Value="25" /> <Setter Property="Width" Value="25" />
<Setter Property="Height" Value="25" /> <Setter Property="Height" Value="25" />
<Setter Property="Background" Value="Transparent" /> <Setter Property="Background" Value="Transparent" />
<Setter Property="CornerRadius" Value="2"/> <Setter Property="CornerRadius" Value="2" />
</Style> </Style>
<ResourceDictionary.ThemeDictionaries> <ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Dark"> <ResourceDictionary x:Key="Dark">
<Style x:Key="FontIconStyle" TargetType="FontIcon"> <Style x:Key="FontIconStyle"
TargetType="FontIcon">
<Setter Property="FontSize" Value="12" /> <Setter Property="FontSize" Value="12" />
</Style> </Style>
<Style x:Key="SearchBoxBackground" TargetType="StackPanel"> <Style x:Key="SearchBoxBackground"
TargetType="StackPanel">
<Setter Property="Background" Value="#333333" /> <Setter Property="Background" Value="#333333" />
</Style> </Style>
<!-- TextBox colors !--> <!-- TextBox colors ! -->
<SolidColorBrush x:Key="TextControlBackground" Color="#333333"/> <SolidColorBrush x:Key="TextControlBackground"
<SolidColorBrush x:Key="TextBoxPlaceholderTextThemeBrush" Color="#B5B5B5"/> Color="#333333" />
<SolidColorBrush x:Key="TextControlForeground" Color="#B5B5B5"/> <SolidColorBrush x:Key="TextBoxPlaceholderTextThemeBrush"
<SolidColorBrush x:Key="TextControlBorderBrush" Color="#404040"/> Color="#B5B5B5" />
<SolidColorBrush x:Key="TextControlButtonForeground" Color="#B5B5B5"/> <SolidColorBrush x:Key="TextControlForeground"
Color="#B5B5B5" />
<SolidColorBrush x:Key="TextControlBorderBrush"
Color="#404040" />
<SolidColorBrush x:Key="TextControlButtonForeground"
Color="#B5B5B5" />
<SolidColorBrush x:Key="TextControlBackgroundPointerOver" Color="#404040"/> <SolidColorBrush x:Key="TextControlBackgroundPointerOver"
<SolidColorBrush x:Key="TextControlForegroundPointerOver" Color="#FFFFFF"/> Color="#404040" />
<SolidColorBrush x:Key="TextControlBorderBrushPointerOver" Color="#404040"/> <SolidColorBrush x:Key="TextControlForegroundPointerOver"
<SolidColorBrush x:Key="TextControlButtonForegroundPointerOver" Color="#FF4343"/> Color="#FFFFFF" />
<SolidColorBrush x:Key="TextControlBorderBrushPointerOver"
Color="#404040" />
<SolidColorBrush x:Key="TextControlButtonForegroundPointerOver"
Color="#FF4343" />
<SolidColorBrush x:Key="TextControlBackgroundFocused" Color="#333333"/> <SolidColorBrush x:Key="TextControlBackgroundFocused"
<SolidColorBrush x:Key="TextControlForegroundFocused" Color="#FFFFFF"/> Color="#333333" />
<SolidColorBrush x:Key="TextControlBorderBrushFocused" Color="#404040"/> <SolidColorBrush x:Key="TextControlForegroundFocused"
<SolidColorBrush x:Key="TextControlButtonForegroundPressed" Color="#FFFFFF"/> Color="#FFFFFF" />
<SolidColorBrush x:Key="TextControlButtonBackgroundPressed" Color="#FF4343"/> <SolidColorBrush x:Key="TextControlBorderBrushFocused"
Color="#404040" />
<SolidColorBrush x:Key="TextControlButtonForegroundPressed"
Color="#FFFFFF" />
<SolidColorBrush x:Key="TextControlButtonBackgroundPressed"
Color="#FF4343" />
<!-- ToggleButton colors !--> <!-- ToggleButton colors ! -->
<SolidColorBrush x:Key="ToggleButtonForeground" Color="#B5B5B5"/> <SolidColorBrush x:Key="ToggleButtonForeground"
Color="#B5B5B5" />
<SolidColorBrush x:Key="ToggleButtonBackgroundPointerOver" Color="#404040"/> <SolidColorBrush x:Key="ToggleButtonBackgroundPointerOver"
<SolidColorBrush x:Key="ToggleButtonForegroundPointerOver" Color="#FFFFFF"/> Color="#404040" />
<SolidColorBrush x:Key="ToggleButtonBorderBrushPointerOver" Color="Transparent"/> <SolidColorBrush x:Key="ToggleButtonForegroundPointerOver"
Color="#FFFFFF" />
<SolidColorBrush x:Key="ToggleButtonBorderBrushPointerOver"
Color="Transparent" />
<SolidColorBrush x:Key="ToggleButtonBackgroundPressed" Color="#555555"/> <SolidColorBrush x:Key="ToggleButtonBackgroundPressed"
<SolidColorBrush x:Key="ToggleButtonForegroundPressed" Color="#FFFFFF"/> Color="#555555" />
<SolidColorBrush x:Key="ToggleButtonBorderBrushPressed" Color="Transparent"/> <SolidColorBrush x:Key="ToggleButtonForegroundPressed"
Color="#FFFFFF" />
<SolidColorBrush x:Key="ToggleButtonBorderBrushPressed"
Color="Transparent" />
<SolidColorBrush x:Key="ToggleButtonBackgroundChecked" Color="#555555"/> <SolidColorBrush x:Key="ToggleButtonBackgroundChecked"
<SolidColorBrush x:Key="ToggleButtonForegroundChecked" Color="#FFFFFF"/> Color="#555555" />
<SolidColorBrush x:Key="ToggleButtonBorderBrushChecked" Color="Transparent"/> <SolidColorBrush x:Key="ToggleButtonForegroundChecked"
Color="#FFFFFF" />
<SolidColorBrush x:Key="ToggleButtonBorderBrushChecked"
Color="Transparent" />
<SolidColorBrush x:Key="ToggleButtonBackgroundCheckedPointerOver" Color="#404040"/> <SolidColorBrush x:Key="ToggleButtonBackgroundCheckedPointerOver"
<SolidColorBrush x:Key="ToggleButtonForegroundCheckedPointerOver" Color="#FFFFFF"/> Color="#404040" />
<SolidColorBrush x:Key="ToggleButtonBorderBrushCheckedPointerOver" Color="Transparent"/> <SolidColorBrush x:Key="ToggleButtonForegroundCheckedPointerOver"
Color="#FFFFFF" />
<SolidColorBrush x:Key="ToggleButtonBorderBrushCheckedPointerOver"
Color="Transparent" />
<SolidColorBrush x:Key="ToggleButtonBackgroundCheckedPressed" Color="#555555"/> <SolidColorBrush x:Key="ToggleButtonBackgroundCheckedPressed"
<SolidColorBrush x:Key="ToggleButtonForegroundCheckedPressed" Color="#FFFFFF"/> Color="#555555" />
<SolidColorBrush x:Key="ToggleButtonBorderBrushCheckedPressed" Color="Transparent"/> <SolidColorBrush x:Key="ToggleButtonForegroundCheckedPressed"
Color="#FFFFFF" />
<SolidColorBrush x:Key="ToggleButtonBorderBrushCheckedPressed"
Color="Transparent" />
<!--Button color !--> <!-- Button color ! -->
<SolidColorBrush x:Key="ButtonBackgroundPointerOver" Color="#404040"/> <SolidColorBrush x:Key="ButtonBackgroundPointerOver"
<SolidColorBrush x:Key="ButtonForegroundPointerOver" Color="#FFFFFF"/> Color="#404040" />
<SolidColorBrush x:Key="ButtonBorderBrushPointerOver" Color="Transparent"/> <SolidColorBrush x:Key="ButtonForegroundPointerOver"
Color="#FFFFFF" />
<SolidColorBrush x:Key="ButtonBorderBrushPointerOver"
Color="Transparent" />
<SolidColorBrush x:Key="ButtonBackgroundPressed" Color="#555555"/> <SolidColorBrush x:Key="ButtonBackgroundPressed"
<SolidColorBrush x:Key="ButtonForegroundPressed" Color="#FFFFFF"/> Color="#555555" />
<SolidColorBrush x:Key="ButtonBorderBrushPressed" Color="Transparent"/> <SolidColorBrush x:Key="ButtonForegroundPressed"
Color="#FFFFFF" />
<SolidColorBrush x:Key="ButtonBorderBrushPressed"
Color="Transparent" />
</ResourceDictionary> </ResourceDictionary>
<ResourceDictionary x:Key="Light"> <ResourceDictionary x:Key="Light">
<Style x:Key="FontIconStyle" TargetType="FontIcon"> <Style x:Key="FontIconStyle"
TargetType="FontIcon">
<Setter Property="FontSize" Value="12" /> <Setter Property="FontSize" Value="12" />
</Style> </Style>
<Style x:Key="SearchBoxBackground" TargetType="StackPanel"> <Style x:Key="SearchBoxBackground"
TargetType="StackPanel">
<Setter Property="Background" Value="#CCCCCC" /> <Setter Property="Background" Value="#CCCCCC" />
</Style> </Style>
<!-- TextBox colors !--> <!-- TextBox colors ! -->
<SolidColorBrush x:Key="TextControlBackground" Color="#CCCCCC"/> <SolidColorBrush x:Key="TextControlBackground"
<SolidColorBrush x:Key="TextBoxPlaceholderTextThemeBrush" Color="#636363"/> Color="#CCCCCC" />
<SolidColorBrush x:Key="TextControlBorderBrush" Color="#636363"/> <SolidColorBrush x:Key="TextBoxPlaceholderTextThemeBrush"
<SolidColorBrush x:Key="TextControlButtonForeground" Color="#636363"/> Color="#636363" />
<SolidColorBrush x:Key="TextControlBorderBrush"
Color="#636363" />
<SolidColorBrush x:Key="TextControlButtonForeground"
Color="#636363" />
<SolidColorBrush x:Key="TextControlBackgroundPointerOver" Color="#DADADA"/> <SolidColorBrush x:Key="TextControlBackgroundPointerOver"
<SolidColorBrush x:Key="TextControlBorderBrushPointerOver" Color="#636363"/> Color="#DADADA" />
<SolidColorBrush x:Key="TextControlButtonForegroundPointerOver" Color="#FF4343"/> <SolidColorBrush x:Key="TextControlBorderBrushPointerOver"
Color="#636363" />
<SolidColorBrush x:Key="TextControlButtonForegroundPointerOver"
Color="#FF4343" />
<SolidColorBrush x:Key="TextControlBackgroundFocused" Color="#CCCCCC"/> <SolidColorBrush x:Key="TextControlBackgroundFocused"
<SolidColorBrush x:Key="TextControlBorderBrushFocused" Color="#636363"/> Color="#CCCCCC" />
<SolidColorBrush x:Key="TextControlButtonForegroundPressed" Color="#FFFFFF"/> <SolidColorBrush x:Key="TextControlBorderBrushFocused"
<SolidColorBrush x:Key="TextControlButtonBackgroundPressed" Color="#FF4343"/> Color="#636363" />
<!-- ToggleButton colors !--> <SolidColorBrush x:Key="TextControlButtonForegroundPressed"
<SolidColorBrush x:Key="ToggleButtonForeground" Color="#636363"/> Color="#FFFFFF" />
<SolidColorBrush x:Key="TextControlButtonBackgroundPressed"
Color="#FF4343" />
<!-- ToggleButton colors ! -->
<SolidColorBrush x:Key="ToggleButtonForeground"
Color="#636363" />
<SolidColorBrush x:Key="ToggleButtonBackgroundPointerOver" Color="#DADADA"/> <SolidColorBrush x:Key="ToggleButtonBackgroundPointerOver"
<SolidColorBrush x:Key="ToggleButtonForegroundPointerOver" Color="#000000"/> Color="#DADADA" />
<SolidColorBrush x:Key="ToggleButtonBorderBrushPointerOver" Color="Transparent"/> <SolidColorBrush x:Key="ToggleButtonForegroundPointerOver"
Color="#000000" />
<SolidColorBrush x:Key="ToggleButtonBorderBrushPointerOver"
Color="Transparent" />
<SolidColorBrush x:Key="ToggleButtonBackgroundPressed" Color="#B8B8B8"/> <SolidColorBrush x:Key="ToggleButtonBackgroundPressed"
<SolidColorBrush x:Key="ToggleButtonForegroundPressed" Color="#000000"/> Color="#B8B8B8" />
<SolidColorBrush x:Key="ToggleButtonBorderBrushPressed" Color="Transparent"/> <SolidColorBrush x:Key="ToggleButtonForegroundPressed"
Color="#000000" />
<SolidColorBrush x:Key="ToggleButtonBorderBrushPressed"
Color="Transparent" />
<SolidColorBrush x:Key="ToggleButtonBackgroundChecked" Color="#B8B8B8"/> <SolidColorBrush x:Key="ToggleButtonBackgroundChecked"
<SolidColorBrush x:Key="ToggleButtonForegroundChecked" Color="#000000"/> Color="#B8B8B8" />
<SolidColorBrush x:Key="ToggleButtonBorderBrushChecked" Color="Transparent"/> <SolidColorBrush x:Key="ToggleButtonForegroundChecked"
Color="#000000" />
<SolidColorBrush x:Key="ToggleButtonBorderBrushChecked"
Color="Transparent" />
<SolidColorBrush x:Key="ToggleButtonBackgroundCheckedPointerOver" Color="#DADADA"/> <SolidColorBrush x:Key="ToggleButtonBackgroundCheckedPointerOver"
<SolidColorBrush x:Key="ToggleButtonForegroundCheckedPointerOver" Color="#000000"/> Color="#DADADA" />
<SolidColorBrush x:Key="ToggleButtonBorderBrushCheckedPointerOver" Color="Transparent"/> <SolidColorBrush x:Key="ToggleButtonForegroundCheckedPointerOver"
Color="#000000" />
<SolidColorBrush x:Key="ToggleButtonBorderBrushCheckedPointerOver"
Color="Transparent" />
<SolidColorBrush x:Key="ToggleButtonBackgroundCheckedPressed" Color="#B8B8B8"/> <SolidColorBrush x:Key="ToggleButtonBackgroundCheckedPressed"
<SolidColorBrush x:Key="ToggleButtonForegroundCheckedPressed" Color="#000000"/> Color="#B8B8B8" />
<SolidColorBrush x:Key="ToggleButtonBorderBrushCheckedPressed" Color="Transparent"/> <SolidColorBrush x:Key="ToggleButtonForegroundCheckedPressed"
Color="#000000" />
<SolidColorBrush x:Key="ToggleButtonBorderBrushCheckedPressed"
Color="Transparent" />
<!-- Button color !--> <!-- Button color ! -->
<SolidColorBrush x:Key="ButtonBackgroundPointerOver" Color="#DADADA"/> <SolidColorBrush x:Key="ButtonBackgroundPointerOver"
<SolidColorBrush x:Key="ButtonForegroundPointerOver" Color="#000000"/> Color="#DADADA" />
<SolidColorBrush x:Key="ButtonBorderBrushPointerOver" Color="Transparent"/> <SolidColorBrush x:Key="ButtonForegroundPointerOver"
Color="#000000" />
<SolidColorBrush x:Key="ButtonBorderBrushPointerOver"
Color="Transparent" />
<SolidColorBrush x:Key="ButtonBackgroundPressed" Color="#B8B8B8"/> <SolidColorBrush x:Key="ButtonBackgroundPressed"
<SolidColorBrush x:Key="ButtonForegroundPressed" Color="#000000"/> Color="#B8B8B8" />
<SolidColorBrush x:Key="ButtonBorderBrushPressed" Color="Transparent"/> <SolidColorBrush x:Key="ButtonForegroundPressed"
Color="#000000" />
<SolidColorBrush x:Key="ButtonBorderBrushPressed"
Color="Transparent" />
</ResourceDictionary> </ResourceDictionary>
<ResourceDictionary x:Key="HighContrast"> <ResourceDictionary x:Key="HighContrast">
<Style x:Key="FontIconStyle" TargetType="FontIcon"> <Style x:Key="FontIconStyle"
TargetType="FontIcon">
<Setter Property="FontSize" Value="12" /> <Setter Property="FontSize" Value="12" />
</Style> </Style>
<Style x:Key="SearchBoxBackground" TargetType="StackPanel"> <Style x:Key="SearchBoxBackground"
TargetType="StackPanel">
<Setter Property="Background" Value="{ThemeResource SystemColorWindowColor}" /> <Setter Property="Background" Value="{ThemeResource SystemColorWindowColor}" />
</Style> </Style>
</ResourceDictionary> </ResourceDictionary>
@ -151,38 +227,44 @@
</ResourceDictionary> </ResourceDictionary>
</UserControl.Resources> </UserControl.Resources>
<StackPanel Orientation="Horizontal" Style="{ThemeResource SearchBoxBackground}" Padding="5" CornerRadius="0,0,2,2"> <StackPanel Padding="5"
<TextBox x:Name="TextBox" CornerRadius="0,0,2,2"
x:Uid="SearchBox_TextBox" Orientation="Horizontal"
CornerRadius="2" Style="{ThemeResource SearchBoxBackground}">
Width="160" <TextBox x:Name="TextBox"
PlaceholderForeground="{ThemeResource TextBoxPlaceholderTextThemeBrush}" x:Uid="SearchBox_TextBox"
FontSize="15" Width="160"
KeyDown="TextBoxKeyDown" Margin="5"
Margin="5" HorizontalAlignment="Left"
HorizontalAlignment="Left" VerticalAlignment="Center"
VerticalAlignment="Center"> CornerRadius="2"
</TextBox> FontSize="15"
KeyDown="TextBoxKeyDown"
PlaceholderForeground="{ThemeResource TextBoxPlaceholderTextThemeBrush}" />
<ToggleButton x:Name="GoBackwardButton" <ToggleButton x:Name="GoBackwardButton"
x:Uid="SearchBox_SearchBackwards" x:Uid="SearchBox_SearchBackwards"
HorizontalAlignment="Right" HorizontalAlignment="Right"
Style="{StaticResource ToggleButtonStyle}"
Click="GoBackwardClicked" Click="GoBackwardClicked"
IsChecked="True"> IsChecked="True"
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE74A;" Style="{ThemeResource FontIconStyle}"/> Style="{StaticResource ToggleButtonStyle}">
<FontIcon FontFamily="Segoe MDL2 Assets"
Glyph="&#xE74A;"
Style="{ThemeResource FontIconStyle}" />
</ToggleButton> </ToggleButton>
<ToggleButton x:Name="GoForwardButton" <ToggleButton x:Name="GoForwardButton"
x:Uid="SearchBox_SearchForwards" x:Uid="SearchBox_SearchForwards"
Style="{StaticResource ToggleButtonStyle}" Click="GoForwardClicked"
Click="GoForwardClicked"> Style="{StaticResource ToggleButtonStyle}">
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE74B;" Style="{ThemeResource FontIconStyle}"/> <FontIcon FontFamily="Segoe MDL2 Assets"
Glyph="&#xE74B;"
Style="{ThemeResource FontIconStyle}" />
</ToggleButton> </ToggleButton>
<ToggleButton x:Name="CaseSensitivityButton" <ToggleButton x:Name="CaseSensitivityButton"
x:Uid="SearchBox_CaseSensitivity" x:Uid="SearchBox_CaseSensitivity"
Style="{StaticResource ToggleButtonStyle}"> Style="{StaticResource ToggleButtonStyle}">
<PathIcon Data="M8.87305 10H7.60156L6.5625 7.25195H2.40625L1.42871 10H0.150391L3.91016 0.197266H5.09961L8.87305 10ZM6.18652 6.21973L4.64844 2.04297C4.59831 1.90625 4.54818 1.6875 4.49805 1.38672H4.4707C4.42513 1.66471 4.37272 1.88346 4.31348 2.04297L2.78906 6.21973H6.18652ZM15.1826 10H14.0615V8.90625H14.0342C13.5465 9.74479 12.8288 10.1641 11.8809 10.1641C11.1836 10.1641 10.6367 9.97949 10.2402 9.61035C9.84831 9.24121 9.65234 8.7513 9.65234 8.14062C9.65234 6.83268 10.4225 6.07161 11.9629 5.85742L14.0615 5.56348C14.0615 4.37402 13.5807 3.7793 12.6191 3.7793C11.776 3.7793 11.015 4.06641 10.3359 4.64062V3.49219C11.0241 3.05469 11.8171 2.83594 12.7148 2.83594C14.36 2.83594 15.1826 3.70638 15.1826 5.44727V10ZM14.0615 6.45898L12.373 6.69141C11.8535 6.76432 11.4616 6.89421 11.1973 7.08105C10.9329 7.26335 10.8008 7.58919 10.8008 8.05859C10.8008 8.40039 10.9215 8.68066 11.1631 8.89941C11.4092 9.11361 11.735 9.2207 12.1406 9.2207C12.6966 9.2207 13.1546 9.02702 13.5146 8.63965C13.8792 8.24772 14.0615 7.75326 14.0615 7.15625V6.45898Z"/> <PathIcon Data="M8.87305 10H7.60156L6.5625 7.25195H2.40625L1.42871 10H0.150391L3.91016 0.197266H5.09961L8.87305 10ZM6.18652 6.21973L4.64844 2.04297C4.59831 1.90625 4.54818 1.6875 4.49805 1.38672H4.4707C4.42513 1.66471 4.37272 1.88346 4.31348 2.04297L2.78906 6.21973H6.18652ZM15.1826 10H14.0615V8.90625H14.0342C13.5465 9.74479 12.8288 10.1641 11.8809 10.1641C11.1836 10.1641 10.6367 9.97949 10.2402 9.61035C9.84831 9.24121 9.65234 8.7513 9.65234 8.14062C9.65234 6.83268 10.4225 6.07161 11.9629 5.85742L14.0615 5.56348C14.0615 4.37402 13.5807 3.7793 12.6191 3.7793C11.776 3.7793 11.015 4.06641 10.3359 4.64062V3.49219C11.0241 3.05469 11.8171 2.83594 12.7148 2.83594C14.36 2.83594 15.1826 3.70638 15.1826 5.44727V10ZM14.0615 6.45898L12.373 6.69141C11.8535 6.76432 11.4616 6.89421 11.1973 7.08105C10.9329 7.26335 10.8008 7.58919 10.8008 8.05859C10.8008 8.40039 10.9215 8.68066 11.1631 8.89941C11.4092 9.11361 11.735 9.2207 12.1406 9.2207C12.6966 9.2207 13.1546 9.02702 13.5146 8.63965C13.8792 8.24772 14.0615 7.75326 14.0615 7.15625V6.45898Z" />
</ToggleButton> </ToggleButton>
<Button x:Name="CloseButton" <Button x:Name="CloseButton"
@ -190,7 +272,9 @@
Padding="0" Padding="0"
Click="CloseClick" Click="CloseClick"
Style="{ThemeResource ButtonStyle}"> Style="{ThemeResource ButtonStyle}">
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE711;" FontSize="12"/> <FontIcon FontFamily="Segoe MDL2 Assets"
FontSize="12"
Glyph="&#xE711;" />
</Button> </Button>
</StackPanel> </StackPanel>
</UserControl> </UserControl>

View File

@ -1,18 +1,17 @@
<UserControl <UserControl x:Class="Microsoft.Terminal.Control.TSFInputControl"
x:Class="Microsoft.Terminal.Control.TSFInputControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" d:DesignHeight="768"
mc:Ignorable="d" d:DesignWidth="1024"
d:DesignHeight="768" mc:Ignorable="d">
d:DesignWidth="1024">
<Canvas x:Name="Canvas" <Canvas x:Name="Canvas"
Visibility="Collapsed"> Visibility="Collapsed">
<TextBlock x:Name="TextBlock" <TextBlock x:Name="TextBlock"
IsTextSelectionEnabled="false" IsTextSelectionEnabled="false"
TextWrapping="Wrap" TextDecorations="Underline"
TextDecorations="Underline" /> TextWrapping="Wrap" />
</Canvas> </Canvas>
</UserControl> </UserControl>

View File

@ -1,30 +1,31 @@
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under <!--
the MIT License. See LICENSE in the project root for license information. --> Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
<UserControl the MIT License. See LICENSE in the project root for license information.
x:Class="Microsoft.Terminal.Control.TermControl" -->
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" <UserControl x:Class="Microsoft.Terminal.Control.TermControl"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Microsoft.Terminal.Control" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="using:Microsoft.Terminal.Control"
mc:Ignorable="d" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
d:DesignHeight="768" d:DesignHeight="768"
d:DesignWidth="1024" d:DesignWidth="1024"
TabNavigation="Cycle" AllowDrop="True"
IsTabStop="True" AllowFocusOnInteraction="True"
AllowFocusOnInteraction="True" CharacterReceived="_CharacterHandler"
AllowDrop="True" DragOver="_DragOverHandler"
Drop="_DragDropHandler" Drop="_DragDropHandler"
DragOver="_DragOverHandler" GotFocus="_GotFocusHandler"
Tapped="_TappedHandler" IsTabStop="True"
PointerWheelChanged="_MouseWheelHandler" KeyUp="_KeyUpHandler"
PreviewKeyDown="_KeyDownHandler" LostFocus="_LostFocusHandler"
KeyUp="_KeyUpHandler" PointerWheelChanged="_MouseWheelHandler"
CharacterReceived="_CharacterHandler" PreviewKeyDown="_KeyDownHandler"
GotFocus="_GotFocusHandler" TabNavigation="Cycle"
LostFocus="_LostFocusHandler"> Tapped="_TappedHandler"
mc:Ignorable="d">
<!-- <!--
TODO GH#4031: We've investigated whether we should be using KeyDown or PreviewKeyDown TODO GH#4031: We've investigated whether we should be using KeyDown or PreviewKeyDown
but not necessarily come to a consensus. It's possible that moving input to the SwapChainPanel but not necessarily come to a consensus. It's possible that moving input to the SwapChainPanel
@ -41,16 +42,16 @@ the MIT License. See LICENSE in the project root for license information. -->
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Grid Grid.Column="0" <Grid Grid.Column="0"
Visibility="Visible"
Background="Transparent" Background="Transparent"
PointerPressed="_PointerPressedHandler" PointerExited="_PointerExitedHandler"
PointerMoved="_PointerMovedHandler" PointerMoved="_PointerMovedHandler"
PointerPressed="_PointerPressedHandler"
PointerReleased="_PointerReleasedHandler" PointerReleased="_PointerReleasedHandler"
PointerExited="_PointerExitedHandler"> Visibility="Visible">
<SwapChainPanel x:Name="SwapChainPanel" <SwapChainPanel x:Name="SwapChainPanel"
SizeChanged="_SwapChainSizeChanged" CompositionScaleChanged="_SwapChainScaleChanged"
CompositionScaleChanged="_SwapChainScaleChanged"> SizeChanged="_SwapChainSizeChanged">
<Canvas x:Name="OverlayCanvas" <Canvas x:Name="OverlayCanvas"
Visibility="Visible"> Visibility="Visible">
@ -60,10 +61,9 @@ the MIT License. See LICENSE in the project root for license information. -->
<ToolTip x:Name="LinkTip" <ToolTip x:Name="LinkTip"
Placement="Mouse"> Placement="Mouse">
<TextBlock IsTextSelectionEnabled="True"> <TextBlock IsTextSelectionEnabled="True">
<Run x:Name="HoveredUri"/> <LineBreak /> <Run x:Name="HoveredUri" /> <LineBreak />
<Run x:Uid="HowToOpenRun" <Run x:Uid="HowToOpenRun"
FontStyle="Italic"> FontStyle="Italic" />
</Run>
</TextBlock> </TextBlock>
</ToolTip> </ToolTip>
</ToolTipService.ToolTip> </ToolTipService.ToolTip>
@ -71,31 +71,33 @@ the MIT License. See LICENSE in the project root for license information. -->
</Canvas> </Canvas>
</SwapChainPanel> </SwapChainPanel>
<!-- Putting this in a grid w/ the SwapChainPanel <!--
ensures that it's always aligned w/ the scrollbar --> Putting this in a grid w/ the SwapChainPanel
ensures that it's always aligned w/ the scrollbar
-->
<local:SearchBoxControl x:Name="SearchBox" <local:SearchBoxControl x:Name="SearchBox"
x:Load="False"
Visibility="Collapsed"
HorizontalAlignment="Right" HorizontalAlignment="Right"
VerticalAlignment="Top" VerticalAlignment="Top"
x:Load="False"
Closed="_CloseSearchBoxControl"
Search="_Search" Search="_Search"
Closed="_CloseSearchBoxControl" /> Visibility="Collapsed" />
</Grid> </Grid>
<ScrollBar Grid.Column="1" <ScrollBar x:Name="ScrollBar"
x:Name="ScrollBar" Grid.Column="1"
Orientation="Vertical"
IndicatorMode="MouseIndicator"
HorizontalAlignment="Right" HorizontalAlignment="Right"
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
Maximum="1" IndicatorMode="MouseIndicator"
ViewportSize="10"
IsTabStop="False" IsTabStop="False"
SmallChange="1"
LargeChange="4" LargeChange="4"
ValueChanged="_ScrollbarChangeHandler" Maximum="1"
Orientation="Vertical"
PointerPressed="_CapturePointer" PointerPressed="_CapturePointer"
PointerReleased="_ReleasePointerCapture" /> PointerReleased="_ReleasePointerCapture"
SmallChange="1"
ValueChanged="_ScrollbarChangeHandler"
ViewportSize="10" />
</Grid> </Grid>
<local:TSFInputControl x:Name="TSFInputControl" <local:TSFInputControl x:Name="TSFInputControl"
@ -104,18 +106,22 @@ the MIT License. See LICENSE in the project root for license information. -->
CurrentFontInfo="_FontInfoHandler" /> CurrentFontInfo="_FontInfoHandler" />
<Grid x:Name="RendererFailedNotice" <Grid x:Name="RendererFailedNotice"
x:Load="False"
HorizontalAlignment="Center" HorizontalAlignment="Center"
VerticalAlignment="Center"> VerticalAlignment="Center"
<Border Background="{ThemeResource SystemControlBackgroundAltHighBrush}" x:Load="False">
BorderBrush="{ThemeResource SystemAccentColor}" <Border Margin="8,8,8,8"
Margin="8,8,8,8"
Padding="8,8,8,8" Padding="8,8,8,8"
Background="{ThemeResource SystemControlBackgroundAltHighBrush}"
BorderBrush="{ThemeResource SystemAccentColor}"
BorderThickness="2,2,2,2" BorderThickness="2,2,2,2"
CornerRadius="{ThemeResource OverlayCornerRadius}"> CornerRadius="{ThemeResource OverlayCornerRadius}">
<StackPanel> <StackPanel>
<TextBlock HorizontalAlignment="Center" x:Uid="TermControl_RendererFailedTextBlock" TextWrapping="WrapWholeWords"/> <TextBlock x:Uid="TermControl_RendererFailedTextBlock"
<Button Click="_RenderRetryButton_Click" x:Uid="TermControl_RendererRetryButton" HorizontalAlignment="Right" /> HorizontalAlignment="Center"
TextWrapping="WrapWholeWords" />
<Button x:Uid="TermControl_RendererRetryButton"
HorizontalAlignment="Right"
Click="_RenderRetryButton_Click" />
</StackPanel> </StackPanel>
</Border> </Border>
</Grid> </Grid>

View File

@ -1,151 +1,188 @@
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under <!--
the MIT License. See LICENSE in the project root for license information. --> Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
<Page the MIT License. See LICENSE in the project root for license information.
x:Class="Microsoft.Terminal.Settings.Editor.Actions" -->
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" <Page x:Class="Microsoft.Terminal.Settings.Editor.Actions"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:local="using:Microsoft.Terminal.Settings.Editor" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:SettingsModel="using:Microsoft.Terminal.Settings.Model"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls" xmlns:local="using:Microsoft.Terminal.Settings.Editor"
xmlns:SettingsModel="using:Microsoft.Terminal.Settings.Model" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"> xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
mc:Ignorable="d">
<Page.Resources> <Page.Resources>
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="CommonResources.xaml"/> <ResourceDictionary Source="CommonResources.xaml" />
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
<local:StringIsEmptyConverter x:Key="CommandKeyChordVisibilityConverter"/> <local:StringIsEmptyConverter x:Key="CommandKeyChordVisibilityConverter" />
<!-- Template for actions. This is _heavily_ copied from the command <!--
palette, with modifications: Template for actions. This is _heavily_ copied from the command
palette, with modifications:
* We don't need to use a HighlightedTextControl, because we're * We don't need to use a HighlightedTextControl, because we're
not filtering this list not filtering this list
* We don't need the chevron for nested commands * We don't need the chevron for nested commands
* We're not displaying the icon * We're not displaying the icon
* We're binding directly to a Command, not a FilteredCommand * We're binding directly to a Command, not a FilteredCommand
If we wanted to reuse the command palette's list more directly, If we wanted to reuse the command palette's list more directly,
that's theoretically possible, but then it would need to be that's theoretically possible, but then it would need to be
lifted out of TerminalApp and either moved into the lifted out of TerminalApp and either moved into the
TerminalSettingsEditor or moved to it's own project consumed by TerminalSettingsEditor or moved to it's own project consumed by
both TSE and TerminalApp. both TSE and TerminalApp.
--> -->
<DataTemplate x:Key="GeneralItemTemplate" x:DataType="SettingsModel:Command"> <DataTemplate x:Key="GeneralItemTemplate"
x:DataType="SettingsModel:Command">
<!-- This HorizontalContentAlignment="Stretch" is important <!--
to make sure it takes the entire width of the line --> This HorizontalContentAlignment="Stretch" is important
to make sure it takes the entire width of the line
-->
<ListViewItem HorizontalContentAlignment="Stretch" <ListViewItem HorizontalContentAlignment="Stretch"
AutomationProperties.Name="{x:Bind Name, Mode=OneWay}" AutomationProperties.AcceleratorKey="{x:Bind KeyChordText, Mode=OneWay}"
AutomationProperties.AcceleratorKey="{x:Bind KeyChordText, Mode=OneWay}"> AutomationProperties.Name="{x:Bind Name, Mode=OneWay}">
<Grid HorizontalAlignment="Stretch" ColumnSpacing="8" > <Grid HorizontalAlignment="Stretch"
ColumnSpacing="8">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="16"/> <ColumnDefinition Width="16" />
<!-- icon --> <!-- icon -->
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto" />
<!-- command label --> <!-- command label -->
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*" />
<!-- key chord --> <!-- key chord -->
<ColumnDefinition Width="32"/> <ColumnDefinition Width="32" />
<!-- gutter for scrollbar --> <!-- gutter for scrollbar -->
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBlock Grid.Column="1" <TextBlock Grid.Column="1"
HorizontalAlignment="Left" HorizontalAlignment="Left"
Text="{x:Bind Name, Mode=OneWay}"/> Text="{x:Bind Name, Mode=OneWay}" />
<!-- The block for the key chord is only visible <!--
when there's actual text set as the label. See The block for the key chord is only visible
CommandKeyChordVisibilityConverter for details. when there's actual text set as the label. See
Inexplicably, we don't need to set the CommandKeyChordVisibilityConverter for details.
AutomationProperties to Raw here, unlike in the Inexplicably, we don't need to set the
CommandPalette. We're not quite sure why.--> AutomationProperties to Raw here, unlike in the
CommandPalette. We're not quite sure why.
-->
<Border Grid.Column="2" <Border Grid.Column="2"
Visibility="{x:Bind KeyChordText,
Mode=OneWay,
Converter={StaticResource CommandKeyChordVisibilityConverter}}"
Style="{ThemeResource KeyChordBorderStyle}"
Padding="2,0,2,0" Padding="2,0,2,0"
HorizontalAlignment="Right" HorizontalAlignment="Right"
VerticalAlignment="Center"> VerticalAlignment="Center"
Style="{ThemeResource KeyChordBorderStyle}"
Visibility="{x:Bind KeyChordText, Mode=OneWay, Converter={StaticResource CommandKeyChordVisibilityConverter}}">
<TextBlock Style="{ThemeResource KeyChordTextBlockStyle}" <TextBlock FontSize="12"
FontSize="12" Style="{ThemeResource KeyChordTextBlockStyle}"
Text="{x:Bind KeyChordText, Mode=OneWay}" /> Text="{x:Bind KeyChordText, Mode=OneWay}" />
</Border> </Border>
</Grid> </Grid>
</ListViewItem> </ListViewItem>
</DataTemplate> </DataTemplate>
<!-- These resources again, HEAVILY copied from the command palette --> <!-- These resources again, HEAVILY copied from the command palette -->
<ResourceDictionary.ThemeDictionaries> <ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Dark"> <ResourceDictionary x:Key="Dark">
<!-- TextBox colors !--> <!-- TextBox colors ! -->
<SolidColorBrush x:Key="TextControlBackground" Color="#333333"/> <SolidColorBrush x:Key="TextControlBackground"
<SolidColorBrush x:Key="TextBoxPlaceholderTextThemeBrush" Color="#B5B5B5"/> Color="#333333" />
<SolidColorBrush x:Key="TextControlForeground" Color="#B5B5B5"/> <SolidColorBrush x:Key="TextBoxPlaceholderTextThemeBrush"
<SolidColorBrush x:Key="TextControlBorderBrush" Color="#404040"/> Color="#B5B5B5" />
<SolidColorBrush x:Key="TextControlButtonForeground" Color="#B5B5B5"/> <SolidColorBrush x:Key="TextControlForeground"
Color="#B5B5B5" />
<SolidColorBrush x:Key="TextControlBorderBrush"
Color="#404040" />
<SolidColorBrush x:Key="TextControlButtonForeground"
Color="#B5B5B5" />
<SolidColorBrush x:Key="TextControlBackgroundPointerOver" Color="#404040"/> <SolidColorBrush x:Key="TextControlBackgroundPointerOver"
<SolidColorBrush x:Key="TextControlForegroundPointerOver" Color="#FFFFFF"/> Color="#404040" />
<SolidColorBrush x:Key="TextControlBorderBrushPointerOver" Color="#404040"/> <SolidColorBrush x:Key="TextControlForegroundPointerOver"
<SolidColorBrush x:Key="TextControlButtonForegroundPointerOver" Color="#FF4343"/> Color="#FFFFFF" />
<SolidColorBrush x:Key="TextControlBorderBrushPointerOver"
Color="#404040" />
<SolidColorBrush x:Key="TextControlButtonForegroundPointerOver"
Color="#FF4343" />
<SolidColorBrush x:Key="TextControlBackgroundFocused" Color="#333333"/> <SolidColorBrush x:Key="TextControlBackgroundFocused"
<SolidColorBrush x:Key="TextControlForegroundFocused" Color="#FFFFFF"/> Color="#333333" />
<SolidColorBrush x:Key="TextControlBorderBrushFocused" Color="#404040"/> <SolidColorBrush x:Key="TextControlForegroundFocused"
<SolidColorBrush x:Key="TextControlButtonForegroundPressed" Color="#FFFFFF"/> Color="#FFFFFF" />
<SolidColorBrush x:Key="TextControlButtonBackgroundPressed" Color="#FF4343"/> <SolidColorBrush x:Key="TextControlBorderBrushFocused"
Color="#404040" />
<SolidColorBrush x:Key="TextControlButtonForegroundPressed"
Color="#FFFFFF" />
<SolidColorBrush x:Key="TextControlButtonBackgroundPressed"
Color="#FF4343" />
<!-- KeyChordText styles --> <!-- KeyChordText styles -->
<Style x:Key="KeyChordBorderStyle" TargetType="Border"> <Style x:Key="KeyChordBorderStyle"
TargetType="Border">
<Setter Property="BorderThickness" Value="1" /> <Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="1" /> <Setter Property="CornerRadius" Value="1" />
<Setter Property="Background" Value="{ThemeResource SystemAltMediumLowColor}" /> <Setter Property="Background" Value="{ThemeResource SystemAltMediumLowColor}" />
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" /> <Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
</Style> </Style>
<Style x:Key="KeyChordTextBlockStyle" TargetType="TextBlock"> <Style x:Key="KeyChordTextBlockStyle"
TargetType="TextBlock">
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" /> <Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
</Style> </Style>
</ResourceDictionary> </ResourceDictionary>
<ResourceDictionary x:Key="Light"> <ResourceDictionary x:Key="Light">
<!-- TextBox colors !--> <!-- TextBox colors ! -->
<SolidColorBrush x:Key="TextControlBackground" Color="#CCCCCC"/> <SolidColorBrush x:Key="TextControlBackground"
<SolidColorBrush x:Key="TextBoxPlaceholderTextThemeBrush" Color="#636363"/> Color="#CCCCCC" />
<SolidColorBrush x:Key="TextControlBorderBrush" Color="#636363"/> <SolidColorBrush x:Key="TextBoxPlaceholderTextThemeBrush"
<SolidColorBrush x:Key="TextControlButtonForeground" Color="#636363"/> Color="#636363" />
<SolidColorBrush x:Key="TextControlBorderBrush"
Color="#636363" />
<SolidColorBrush x:Key="TextControlButtonForeground"
Color="#636363" />
<SolidColorBrush x:Key="TextControlBackgroundPointerOver" Color="#DADADA"/> <SolidColorBrush x:Key="TextControlBackgroundPointerOver"
<SolidColorBrush x:Key="TextControlBorderBrushPointerOver" Color="#636363"/> Color="#DADADA" />
<SolidColorBrush x:Key="TextControlButtonForegroundPointerOver" Color="#FF4343"/> <SolidColorBrush x:Key="TextControlBorderBrushPointerOver"
Color="#636363" />
<SolidColorBrush x:Key="TextControlButtonForegroundPointerOver"
Color="#FF4343" />
<SolidColorBrush x:Key="TextControlBackgroundFocused" Color="#CCCCCC"/> <SolidColorBrush x:Key="TextControlBackgroundFocused"
<SolidColorBrush x:Key="TextControlBorderBrushFocused" Color="#636363"/> Color="#CCCCCC" />
<SolidColorBrush x:Key="TextControlButtonForegroundPressed" Color="#FFFFFF"/> <SolidColorBrush x:Key="TextControlBorderBrushFocused"
<SolidColorBrush x:Key="TextControlButtonBackgroundPressed" Color="#FF4343"/> Color="#636363" />
<SolidColorBrush x:Key="TextControlButtonForegroundPressed"
Color="#FFFFFF" />
<SolidColorBrush x:Key="TextControlButtonBackgroundPressed"
Color="#FF4343" />
<!-- KeyChordText styles --> <!-- KeyChordText styles -->
<Style x:Key="KeyChordBorderStyle" TargetType="Border"> <Style x:Key="KeyChordBorderStyle"
TargetType="Border">
<Setter Property="BorderThickness" Value="1" /> <Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="1" /> <Setter Property="CornerRadius" Value="1" />
<Setter Property="Background" Value="{ThemeResource SystemAltMediumLowColor}" /> <Setter Property="Background" Value="{ThemeResource SystemAltMediumLowColor}" />
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" /> <Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
</Style> </Style>
<Style x:Key="KeyChordTextBlockStyle" TargetType="TextBlock"> <Style x:Key="KeyChordTextBlockStyle"
TargetType="TextBlock">
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" /> <Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
</Style> </Style>
</ResourceDictionary> </ResourceDictionary>
<ResourceDictionary x:Key="HighContrast"> <ResourceDictionary x:Key="HighContrast">
<!-- KeyChordText styles (use XAML defaults for High Contrast theme) --> <!-- KeyChordText styles (use XAML defaults for High Contrast theme) -->
<Style x:Key="KeyChordBorderStyle" TargetType="Border"/> <Style x:Key="KeyChordBorderStyle"
<Style x:Key="KeyChordTextBlockStyle" TargetType="TextBlock"/> TargetType="Border" />
<Style x:Key="KeyChordTextBlockStyle"
TargetType="TextBlock" />
</ResourceDictionary> </ResourceDictionary>
</ResourceDictionary.ThemeDictionaries> </ResourceDictionary.ThemeDictionaries>
@ -157,30 +194,34 @@ the MIT License. See LICENSE in the project root for license information. -->
<ScrollViewer> <ScrollViewer>
<StackPanel Style="{StaticResource SettingsStackStyle}"> <StackPanel Style="{StaticResource SettingsStackStyle}">
<TextBlock x:Uid="Globals_KeybindingsDisclaimer" <TextBlock x:Uid="Globals_KeybindingsDisclaimer"
Style="{StaticResource DisclaimerStyle}"/> Style="{StaticResource DisclaimerStyle}" />
<!-- The Nav_OpenJSON resource just so happens to have a .Content <!--
and .Tooltip that are _exactly_ what we're looking for here. --> The Nav_OpenJSON resource just so happens to have a .Content
and .Tooltip that are _exactly_ what we're looking for here.
-->
<HyperlinkButton x:Uid="Nav_OpenJSON" <HyperlinkButton x:Uid="Nav_OpenJSON"
Click="_OpenSettingsClick" /> Click="_OpenSettingsClick" />
<!-- Keybindings --> <!-- Keybindings -->
<!-- NOTE: Globals_Keybindings.Header is not defined, because that <!--
would result in the page having "Keybindings" displayed twice, which NOTE: Globals_Keybindings.Header is not defined, because that
looks quite redundant --> would result in the page having "Keybindings" displayed twice, which
<ContentPresenter x:Uid="Globals_Keybindings" Margin="0"> looks quite redundant
-->
<ContentPresenter x:Uid="Globals_Keybindings"
Margin="0">
<ListView HorizontalAlignment="Stretch" <ListView HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
SelectionMode="None"
IsItemClickEnabled="False"
CanReorderItems="False"
AllowDrop="False" AllowDrop="False"
CanReorderItems="False"
IsItemClickEnabled="False"
ItemTemplate="{StaticResource GeneralItemTemplate}"
ItemsSource="{x:Bind FilteredActions, Mode=OneWay}" ItemsSource="{x:Bind FilteredActions, Mode=OneWay}"
ItemTemplate="{StaticResource GeneralItemTemplate}"> SelectionMode="None" />
</ListView>
</ContentPresenter> </ContentPresenter>

View File

@ -1,140 +1,135 @@
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under <!--
the MIT License. See LICENSE in the project root for license information. --> Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
<Page the MIT License. See LICENSE in the project root for license information.
x:Class="Microsoft.Terminal.Settings.Editor.ColorSchemes" -->
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" <Page x:Class="Microsoft.Terminal.Settings.Editor.ColorSchemes"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:local="using:Microsoft.Terminal.Settings.Editor" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:model="using:Microsoft.Terminal.Settings.Model" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls" xmlns:local="using:Microsoft.Terminal.Settings.Editor"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:model="using:Microsoft.Terminal.Settings.Model"
mc:Ignorable="d"> xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
mc:Ignorable="d">
<Page.Resources> <Page.Resources>
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="CommonResources.xaml"/> <ResourceDictionary Source="CommonResources.xaml" />
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
<Style x:Key="GroupHeaderStyle" TargetType="TextBlock" BasedOn="{StaticResource SubtitleTextBlockStyle}"> <Style x:Key="GroupHeaderStyle"
<Setter Property="Margin" Value="0,0,0,4"/> BasedOn="{StaticResource SubtitleTextBlockStyle}"
TargetType="TextBlock">
<Setter Property="Margin" Value="0,0,0,4" />
</Style> </Style>
<Style x:Key="ColorLabelStyle" TargetType="TextBlock"> <Style x:Key="ColorLabelStyle"
<Setter Property="HorizontalAlignment" Value="Left"/> TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style> </Style>
<Style x:Key="ColorTableGridStyle" TargetType="Grid"> <Style x:Key="ColorTableGridStyle"
<Setter Property="RowSpacing" Value="10"/> TargetType="Grid">
<Setter Property="ColumnSpacing" Value="10"/> <Setter Property="RowSpacing" Value="10" />
<Setter Property="ColumnSpacing" Value="10" />
</Style> </Style>
<Style x:Key="ColorControlStyle" TargetType="ContentControl"> <Style x:Key="ColorControlStyle"
<Setter Property="IsTabStop" Value="False"/> TargetType="ContentControl">
<Setter Property="IsTabStop" Value="False" />
</Style> </Style>
<Style x:Key="ColorButtonStyle" TargetType="Button" BasedOn="{StaticResource BaseButtonStyle}"> <Style x:Key="ColorButtonStyle"
<Setter Property="BorderBrush" Value="{StaticResource SystemBaseLowColor}"/> BasedOn="{StaticResource BaseButtonStyle}"
<Setter Property="Height" Value="30"/> TargetType="Button">
<Setter Property="Width" Value="100"/> <Setter Property="BorderBrush" Value="{StaticResource SystemBaseLowColor}" />
<Setter Property="Height" Value="30" />
<Setter Property="Width" Value="100" />
</Style> </Style>
<Style TargetType="ColorPicker"> <Style TargetType="ColorPicker">
<Setter Property="IsColorSliderVisible" Value="False"/> <Setter Property="IsColorSliderVisible" Value="False" />
<Setter Property="IsColorChannelTextInputVisible" Value="False"/> <Setter Property="IsColorChannelTextInputVisible" Value="False" />
<Setter Property="IsHexInputVisible" Value="True"/> <Setter Property="IsHexInputVisible" Value="True" />
<Setter Property="IsAlphaSliderVisible" Value="True"/> <Setter Property="IsAlphaSliderVisible" Value="True" />
<Setter Property="IsAlphaTextInputVisible" Value="True"/> <Setter Property="IsAlphaTextInputVisible" Value="True" />
</Style> </Style>
<DataTemplate x:Key="ColorTableEntryTemplate" x:DataType="local:ColorTableEntry"> <DataTemplate x:Key="ColorTableEntryTemplate"
<Button Background="{x:Bind Color, Converter={StaticResource ColorToBrushConverter}, Mode=OneWay}" x:DataType="local:ColorTableEntry">
ToolTipService.ToolTip="{x:Bind Name}" <Button AutomationProperties.Name="{x:Bind Name}"
AutomationProperties.Name="{x:Bind Name}" Background="{x:Bind Color, Converter={StaticResource ColorToBrushConverter}, Mode=OneWay}"
Style="{StaticResource ColorButtonStyle}"> Style="{StaticResource ColorButtonStyle}"
ToolTipService.ToolTip="{x:Bind Name}">
<Button.Resources> <Button.Resources>
<!-- Resources to colorize hover/pressed states based on the color of the button --> <!-- Resources to colorize hover/pressed states based on the color of the button -->
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.ThemeDictionaries> <ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Light"> <ResourceDictionary x:Key="Light">
<SolidColorBrush x:Key="ButtonBackgroundPointerOver" Color="{x:Bind Color, Converter={StaticResource ColorLightenConverter}, Mode=OneWay}"/> <SolidColorBrush x:Key="ButtonBackgroundPointerOver"
Color="{x:Bind Color, Converter={StaticResource ColorLightenConverter}, Mode=OneWay}" />
</ResourceDictionary> </ResourceDictionary>
<ResourceDictionary x:Key="Dark"> <ResourceDictionary x:Key="Dark">
<SolidColorBrush x:Key="ButtonBackgroundPointerOver" Color="{x:Bind Color, Converter={StaticResource ColorLightenConverter}, Mode=OneWay}"/> <SolidColorBrush x:Key="ButtonBackgroundPointerOver"
Color="{x:Bind Color, Converter={StaticResource ColorLightenConverter}, Mode=OneWay}" />
</ResourceDictionary> </ResourceDictionary>
<!-- No High contrast dictionary, let's just leave that unchanged. --> <!-- No High contrast dictionary, let's just leave that unchanged. -->
</ResourceDictionary.ThemeDictionaries> </ResourceDictionary.ThemeDictionaries>
</ResourceDictionary> </ResourceDictionary>
</Button.Resources> </Button.Resources>
<Button.Flyout> <Button.Flyout>
<Flyout> <Flyout>
<ColorPicker Tag="{x:Bind Tag, Mode=OneWay}" <ColorPicker ColorChanged="ColorPickerChanged"
Color="{x:Bind Color, Mode=OneWay}" Tag="{x:Bind Tag, Mode=OneWay}"
ColorChanged="ColorPickerChanged"/> Color="{x:Bind Color, Mode=OneWay}" />
</Flyout> </Flyout>
</Button.Flyout> </Button.Flyout>
</Button> </Button>
</DataTemplate> </DataTemplate>
<local:ColorToBrushConverter x:Key="ColorToBrushConverter"/> <local:ColorToBrushConverter x:Key="ColorToBrushConverter" />
<local:ColorToHexConverter x:Key="ColorToHexConverter"/> <local:ColorToHexConverter x:Key="ColorToHexConverter" />
<local:InvertedBooleanToVisibilityConverter x:Key="InvertedBooleanToVisibilityConverter"/> <local:InvertedBooleanToVisibilityConverter x:Key="InvertedBooleanToVisibilityConverter" />
<local:ColorLightenConverter x:Key="ColorLightenConverter"/> <local:ColorLightenConverter x:Key="ColorLightenConverter" />
</ResourceDictionary> </ResourceDictionary>
</Page.Resources> </Page.Resources>
<ScrollViewer> <ScrollViewer>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<VisualState>
<VisualState.StateTriggers>
<!--Official guidance states that 640 is the breakpoint between small and medium devices.
Since MinWindowWidth is an inclusive range, we need to add 1 to it.-->
<AdaptiveTrigger MinWindowWidth="641"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="ColorPanel.Orientation" Value="Horizontal"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<StackPanel Margin="{StaticResource StandardIndentMargin}" <StackPanel Margin="{StaticResource StandardIndentMargin}"
Spacing="24"> Spacing="24">
<!--Select Color and Add New Button--> <!-- Select Color and Add New Button -->
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<StackPanel Orientation="Horizontal" <StackPanel Orientation="Horizontal"
Visibility="{x:Bind IsRenaming, Converter={StaticResource InvertedBooleanToVisibilityConverter}, Mode=OneWay}"> Visibility="{x:Bind IsRenaming, Converter={StaticResource InvertedBooleanToVisibilityConverter}, Mode=OneWay}">
<!--Select a color scheme--> <!-- Select a color scheme -->
<ComboBox x:Name="ColorSchemeComboBox" <ComboBox x:Name="ColorSchemeComboBox"
SelectedIndex="0"
ItemsSource="{x:Bind ColorSchemeList, Mode=OneWay}" ItemsSource="{x:Bind ColorSchemeList, Mode=OneWay}"
SelectedIndex="0"
SelectionChanged="ColorSchemeSelectionChanged" SelectionChanged="ColorSchemeSelectionChanged"
Style="{StaticResource ComboBoxSettingStyle}"> Style="{StaticResource ComboBoxSettingStyle}">
<ComboBox.ItemTemplate> <ComboBox.ItemTemplate>
<DataTemplate x:DataType="model:ColorScheme"> <DataTemplate x:DataType="model:ColorScheme">
<TextBlock Text="{x:Bind Name, Mode=OneWay}"/> <TextBlock Text="{x:Bind Name, Mode=OneWay}" />
</DataTemplate> </DataTemplate>
</ComboBox.ItemTemplate> </ComboBox.ItemTemplate>
</ComboBox> </ComboBox>
<!--Rename Button--> <!-- Rename Button -->
<!--Bind IsEnabled to prevent a the color scheme from returning from the dead--> <!-- Bind IsEnabled to prevent a the color scheme from returning from the dead -->
<Button x:Uid="Rename" <Button x:Name="RenameButton"
x:Name="RenameButton" x:Uid="Rename"
Style="{StaticResource SmallButtonStyle}"
Click="Rename_Click" Click="Rename_Click"
IsEnabled="{x:Bind CanDeleteCurrentScheme, Mode=OneWay}"> IsEnabled="{x:Bind CanDeleteCurrentScheme, Mode=OneWay}"
Style="{StaticResource SmallButtonStyle}">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<FontIcon Glyph="&#xE8AC;" <FontIcon FontSize="{StaticResource StandardIconSize}"
FontSize="{StaticResource StandardIconSize}"/> Glyph="&#xE8AC;" />
</StackPanel> </StackPanel>
</Button> </Button>
</StackPanel> </StackPanel>
@ -142,152 +137,152 @@ the MIT License. See LICENSE in the project root for license information. -->
<StackPanel Orientation="Horizontal" <StackPanel Orientation="Horizontal"
Visibility="{x:Bind IsRenaming, Mode=OneWay}"> Visibility="{x:Bind IsRenaming, Mode=OneWay}">
<!--Shown when color scheme name is already in use--> <!-- Shown when color scheme name is already in use -->
<muxc:TeachingTip x:Name="RenameErrorTip" <muxc:TeachingTip x:Name="RenameErrorTip"
x:Uid="ColorScheme_RenameErrorTip"/> x:Uid="ColorScheme_RenameErrorTip" />
<!--Name text box--> <!-- Name text box -->
<TextBox x:Name="NameBox" <TextBox x:Name="NameBox"
Style="{StaticResource TextBoxSettingStyle}" PreviewKeyDown="NameBox_PreviewKeyDown"
PreviewKeyDown="NameBox_PreviewKeyDown"/> Style="{StaticResource TextBoxSettingStyle}" />
<!--Accept rename button--> <!-- Accept rename button -->
<Button x:Uid="RenameAccept" <Button x:Name="RenameAcceptButton"
x:Name="RenameAcceptButton" x:Uid="RenameAccept"
Style="{StaticResource AccentSmallButtonStyle}" Click="RenameAccept_Click"
Click="RenameAccept_Click"> Style="{StaticResource AccentSmallButtonStyle}">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<FontIcon Glyph="&#xE8FB;" <FontIcon FontSize="{StaticResource StandardIconSize}"
FontSize="{StaticResource StandardIconSize}"/> Glyph="&#xE8FB;" />
</StackPanel> </StackPanel>
</Button> </Button>
<!--Cancel rename button--> <!-- Cancel rename button -->
<Button x:Uid="RenameCancel" <Button x:Name="RenameCancelButton"
x:Name="RenameCancelButton" x:Uid="RenameCancel"
Style="{StaticResource SmallButtonStyle}" Click="RenameCancel_Click"
Click="RenameCancel_Click"> Style="{StaticResource SmallButtonStyle}">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<FontIcon Glyph="&#xE711;" <FontIcon FontSize="{StaticResource StandardIconSize}"
FontSize="{StaticResource StandardIconSize}"/> Glyph="&#xE711;" />
</StackPanel> </StackPanel>
</Button> </Button>
</StackPanel> </StackPanel>
<!--Add new button--> <!-- Add new button -->
<Button x:Name="AddNewButton" <Button x:Name="AddNewButton"
Click="AddNew_Click" Click="AddNew_Click"
Style="{StaticResource BrowseButtonStyle}"> Style="{StaticResource BrowseButtonStyle}">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<FontIcon Glyph="&#xE710;" <FontIcon FontSize="{StaticResource StandardIconSize}"
FontSize="{StaticResource StandardIconSize}"/> Glyph="&#xE710;" />
<TextBlock x:Uid="ColorScheme_AddNewButton" <TextBlock x:Uid="ColorScheme_AddNewButton"
Style="{StaticResource IconButtonTextBlockStyle}"/> Style="{StaticResource IconButtonTextBlockStyle}" />
</StackPanel> </StackPanel>
</Button> </Button>
</StackPanel> </StackPanel>
<!-- Terminal Colors (Left Column)--> <!-- Terminal Colors (Left Column) -->
<StackPanel x:Name="ColorPanel" <StackPanel x:Name="ColorPanel"
Spacing="48"> Spacing="48">
<StackPanel> <StackPanel>
<TextBlock x:Uid="ColorScheme_TerminalColorsHeader" <TextBlock x:Uid="ColorScheme_TerminalColorsHeader"
Style="{StaticResource GroupHeaderStyle}"/> Style="{StaticResource GroupHeaderStyle}" />
<Grid x:Name="ColorTableGrid" <Grid x:Name="ColorTableGrid"
Style="{StaticResource ColorTableGridStyle}"> Style="{StaticResource ColorTableGridStyle}">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<!--Labels--> <!-- Labels -->
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto" />
<!--Regular Colors--> <!-- Regular Colors -->
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto" />
<!--Bright Colors--> <!-- Bright Colors -->
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
</Grid> </Grid>
</StackPanel> </StackPanel>
<!-- System Colors (Right Column) --> <!-- System Colors (Right Column) -->
<StackPanel> <StackPanel>
<TextBlock x:Uid="ColorScheme_SystemColorsHeader" <TextBlock x:Uid="ColorScheme_SystemColorsHeader"
Style="{StaticResource GroupHeaderStyle}"/> Style="{StaticResource GroupHeaderStyle}" />
<Grid Style="{StaticResource ColorTableGridStyle}"> <Grid Style="{StaticResource ColorTableGridStyle}">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<!--Foreground--> <!-- Foreground -->
<TextBlock x:Uid="ColorScheme_Foreground" <TextBlock x:Uid="ColorScheme_Foreground"
Style="{StaticResource ColorLabelStyle}"
Grid.Row="0" Grid.Row="0"
Grid.Column="0"/> Grid.Column="0"
Style="{StaticResource ColorLabelStyle}" />
<ContentControl x:Name="ForegroundButton" <ContentControl x:Name="ForegroundButton"
ContentTemplate="{StaticResource ColorTableEntryTemplate}"
Content="{x:Bind CurrentForegroundColor, Mode=TwoWay}"
Style="{StaticResource ColorControlStyle}"
Grid.Row="0" Grid.Row="0"
Grid.Column="1"/> Grid.Column="1"
Content="{x:Bind CurrentForegroundColor, Mode=TwoWay}"
ContentTemplate="{StaticResource ColorTableEntryTemplate}"
Style="{StaticResource ColorControlStyle}" />
<!--Background--> <!-- Background -->
<TextBlock x:Uid="ColorScheme_Background" <TextBlock x:Uid="ColorScheme_Background"
Style="{StaticResource ColorLabelStyle}"
Grid.Row="1" Grid.Row="1"
Grid.Column="0"/> Grid.Column="0"
Style="{StaticResource ColorLabelStyle}" />
<ContentControl x:Name="BackgroundButton" <ContentControl x:Name="BackgroundButton"
ContentTemplate="{StaticResource ColorTableEntryTemplate}"
Content="{x:Bind CurrentBackgroundColor, Mode=TwoWay}"
Style="{StaticResource ColorControlStyle}"
Grid.Row="1" Grid.Row="1"
Grid.Column="1"/> Grid.Column="1"
Content="{x:Bind CurrentBackgroundColor, Mode=TwoWay}"
ContentTemplate="{StaticResource ColorTableEntryTemplate}"
Style="{StaticResource ColorControlStyle}" />
<!--Cursor Color--> <!-- Cursor Color -->
<TextBlock x:Uid="ColorScheme_CursorColor" <TextBlock x:Uid="ColorScheme_CursorColor"
Style="{StaticResource ColorLabelStyle}"
Grid.Row="2" Grid.Row="2"
Grid.Column="0"/> Grid.Column="0"
Style="{StaticResource ColorLabelStyle}" />
<ContentControl x:Name="CursorColorButton" <ContentControl x:Name="CursorColorButton"
ContentTemplate="{StaticResource ColorTableEntryTemplate}"
Content="{x:Bind CurrentCursorColor, Mode=TwoWay}"
Style="{StaticResource ColorControlStyle}"
Grid.Row="2" Grid.Row="2"
Grid.Column="1"/> Grid.Column="1"
Content="{x:Bind CurrentCursorColor, Mode=TwoWay}"
<!--Selection Background-->
<TextBlock x:Uid="ColorScheme_SelectionBackground"
Style="{StaticResource ColorLabelStyle}"
Grid.Row="3"
Grid.Column="0"/>
<ContentControl x:Name="SelectionBackgroundButton"
ContentTemplate="{StaticResource ColorTableEntryTemplate}" ContentTemplate="{StaticResource ColorTableEntryTemplate}"
Content="{x:Bind CurrentSelectionBackgroundColor, Mode=TwoWay}" Style="{StaticResource ColorControlStyle}" />
Style="{StaticResource ColorControlStyle}"
<!-- Selection Background -->
<TextBlock x:Uid="ColorScheme_SelectionBackground"
Grid.Row="3"
Grid.Column="0"
Style="{StaticResource ColorLabelStyle}" />
<ContentControl x:Name="SelectionBackgroundButton"
Grid.Row="3" Grid.Row="3"
Grid.Column="1"/> Grid.Column="1"
Content="{x:Bind CurrentSelectionBackgroundColor, Mode=TwoWay}"
ContentTemplate="{StaticResource ColorTableEntryTemplate}"
Style="{StaticResource ColorControlStyle}" />
</Grid> </Grid>
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>
<!--Delete Button--> <!-- Delete Button -->
<StackPanel Style="{StaticResource PivotStackStyle}"> <StackPanel Style="{StaticResource PivotStackStyle}">
<Button x:Name="DeleteButton" <Button x:Name="DeleteButton"
IsEnabled="{x:Bind CanDeleteCurrentScheme, Mode=OneWay}" IsEnabled="{x:Bind CanDeleteCurrentScheme, Mode=OneWay}"
@ -296,54 +291,89 @@ the MIT License. See LICENSE in the project root for license information. -->
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.ThemeDictionaries> <ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Light"> <ResourceDictionary x:Key="Light">
<SolidColorBrush x:Key="ButtonBackground" Color="Firebrick"/> <SolidColorBrush x:Key="ButtonBackground"
<SolidColorBrush x:Key="ButtonBackgroundPointerOver" Color="#C23232"/> Color="Firebrick" />
<SolidColorBrush x:Key="ButtonBackgroundPressed" Color="#A21212"/> <SolidColorBrush x:Key="ButtonBackgroundPointerOver"
<SolidColorBrush x:Key="ButtonForeground" Color="White"/> Color="#C23232" />
<SolidColorBrush x:Key="ButtonForegroundPointerOver" Color="White"/> <SolidColorBrush x:Key="ButtonBackgroundPressed"
<SolidColorBrush x:Key="ButtonForegroundPressed" Color="White"/> Color="#A21212" />
<SolidColorBrush x:Key="ButtonForeground"
Color="White" />
<SolidColorBrush x:Key="ButtonForegroundPointerOver"
Color="White" />
<SolidColorBrush x:Key="ButtonForegroundPressed"
Color="White" />
</ResourceDictionary> </ResourceDictionary>
<ResourceDictionary x:Key="Dark"> <ResourceDictionary x:Key="Dark">
<SolidColorBrush x:Key="ButtonBackground" Color="Firebrick"/> <SolidColorBrush x:Key="ButtonBackground"
<SolidColorBrush x:Key="ButtonBackgroundPointerOver" Color="#C23232"/> Color="Firebrick" />
<SolidColorBrush x:Key="ButtonBackgroundPressed" Color="#A21212"/> <SolidColorBrush x:Key="ButtonBackgroundPointerOver"
<SolidColorBrush x:Key="ButtonForeground" Color="White"/> Color="#C23232" />
<SolidColorBrush x:Key="ButtonForegroundPointerOver" Color="White"/> <SolidColorBrush x:Key="ButtonBackgroundPressed"
<SolidColorBrush x:Key="ButtonForegroundPressed" Color="White"/> Color="#A21212" />
<SolidColorBrush x:Key="ButtonForeground"
Color="White" />
<SolidColorBrush x:Key="ButtonForegroundPointerOver"
Color="White" />
<SolidColorBrush x:Key="ButtonForegroundPressed"
Color="White" />
</ResourceDictionary> </ResourceDictionary>
<ResourceDictionary x:Key="HighContrast"> <ResourceDictionary x:Key="HighContrast">
<SolidColorBrush x:Key="ButtonBackground" Color="{ThemeResource SystemColorButtonFaceColor}"/> <SolidColorBrush x:Key="ButtonBackground"
<SolidColorBrush x:Key="ButtonBackgroundPointerOver" Color="{ThemeResource SystemColorHighlightColor}"/> Color="{ThemeResource SystemColorButtonFaceColor}" />
<SolidColorBrush x:Key="ButtonBackgroundPressed" Color="{ThemeResource SystemColorHighlightColor}"/> <SolidColorBrush x:Key="ButtonBackgroundPointerOver"
<SolidColorBrush x:Key="ButtonForeground" Color="{ThemeResource SystemColorButtonTextColor}"/> Color="{ThemeResource SystemColorHighlightColor}" />
<SolidColorBrush x:Key="ButtonForegroundPointerOver" Color="{ThemeResource SystemColorHighlightTextColor}"/> <SolidColorBrush x:Key="ButtonBackgroundPressed"
<SolidColorBrush x:Key="ButtonForegroundPressed" Color="{ThemeResource SystemColorHighlightTextColor}"/> Color="{ThemeResource SystemColorHighlightColor}" />
<SolidColorBrush x:Key="ButtonForeground"
Color="{ThemeResource SystemColorButtonTextColor}" />
<SolidColorBrush x:Key="ButtonForegroundPointerOver"
Color="{ThemeResource SystemColorHighlightTextColor}" />
<SolidColorBrush x:Key="ButtonForegroundPressed"
Color="{ThemeResource SystemColorHighlightTextColor}" />
</ResourceDictionary> </ResourceDictionary>
</ResourceDictionary.ThemeDictionaries> </ResourceDictionary.ThemeDictionaries>
</ResourceDictionary> </ResourceDictionary>
</Button.Resources> </Button.Resources>
<Button.Content> <Button.Content>
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<FontIcon Glyph="&#xE74D;"/> <FontIcon Glyph="&#xE74D;" />
<TextBlock x:Uid="ColorScheme_DeleteButton" <TextBlock x:Uid="ColorScheme_DeleteButton"
Style="{StaticResource IconButtonTextBlockStyle}"/> Style="{StaticResource IconButtonTextBlockStyle}" />
</StackPanel> </StackPanel>
</Button.Content> </Button.Content>
<Button.Flyout> <Button.Flyout>
<Flyout> <Flyout>
<StackPanel> <StackPanel>
<TextBlock x:Uid="ColorScheme_DeleteConfirmationMessage" <TextBlock x:Uid="ColorScheme_DeleteConfirmationMessage"
Style="{StaticResource CustomFlyoutTextStyle}"/> Style="{StaticResource CustomFlyoutTextStyle}" />
<Button x:Uid="ColorScheme_DeleteConfirmationButton" <Button x:Uid="ColorScheme_DeleteConfirmationButton"
Click="DeleteConfirmation_Click"/> Click="DeleteConfirmation_Click" />
</StackPanel> </StackPanel>
</Flyout> </Flyout>
</Button.Flyout> </Button.Flyout>
</Button> </Button>
<TextBlock x:Name="DeleteButtonDisclaimer" <TextBlock x:Name="DeleteButtonDisclaimer"
Style="{StaticResource DisclaimerStyle}" VerticalAlignment="Center"
VerticalAlignment="Center"/> Style="{StaticResource DisclaimerStyle}" />
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<VisualState>
<VisualState.StateTriggers>
<!--
Official guidance states that 640 is the breakpoint between small and medium devices.
Since MinWindowWidth is an inclusive range, we need to add 1 to it.
-->
<AdaptiveTrigger MinWindowWidth="641" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="ColorPanel.Orientation" Value="Horizontal" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</ScrollViewer> </ScrollViewer>
</Page> </Page>

View File

@ -1,13 +1,14 @@
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under <!--
the MIT License. See LICENSE in the project root for license information. --> Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
<ResourceDictionary the MIT License. See LICENSE in the project root for license information.
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" -->
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls">
<!--Merge SettingContainerStyle here to give every page access to the SettingContainer--> <!-- Merge SettingContainerStyle here to give every page access to the SettingContainer -->
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="SettingContainerStyle.xaml"/> <ResourceDictionary Source="SettingContainerStyle.xaml" />
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
<x:Double x:Key="StandardIconSize">14.0</x:Double> <x:Double x:Key="StandardIconSize">14.0</x:Double>
@ -15,99 +16,127 @@ the MIT License. See LICENSE in the project root for license information. -->
<Thickness x:Key="StandardControlMargin">0,24,0,0</Thickness> <Thickness x:Key="StandardControlMargin">0,24,0,0</Thickness>
<x:Double x:Key="StandardBoxMinWidth">250</x:Double> <x:Double x:Key="StandardBoxMinWidth">250</x:Double>
<!-- This is for styling the entire items control used on the <!--
color schemes page--> This is for styling the entire items control used on the
<Style x:Key="ItemsControlStyle" TargetType="ItemsControl"> color schemes page
<Setter Property="Margin" Value="{StaticResource StandardControlMargin}"/> -->
<Style x:Key="ItemsControlStyle"
TargetType="ItemsControl">
<Setter Property="Margin" Value="{StaticResource StandardControlMargin}" />
</Style> </Style>
<!--Used to stack a group of settings--> <!-- Used to stack a group of settings -->
<Style x:Key="SettingsStackStyle" TargetType="StackPanel"> <Style x:Key="SettingsStackStyle"
<Setter Property="HorizontalAlignment" Value="Left"/> TargetType="StackPanel">
<Setter Property="Margin" Value="13,0,0,48"/> <Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="Margin" Value="13,0,0,48" />
</Style> </Style>
<!--Used to stack a group of settings inside a pivot--> <!-- Used to stack a group of settings inside a pivot -->
<Style x:Key="PivotStackStyle" TargetType="StackPanel"> <Style x:Key="PivotStackStyle"
<Setter Property="HorizontalAlignment" Value="Left"/> TargetType="StackPanel">
<Setter Property="Margin" Value="0,0,0,48"/> <Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="Margin" Value="0,0,0,48" />
</Style> </Style>
<!--Combo Box--> <!-- Combo Box -->
<Style x:Key="ComboBoxSettingStyle" TargetType="ComboBox" BasedOn="{StaticResource DefaultComboBoxStyle}"> <Style x:Key="ComboBoxSettingStyle"
<Setter Property="MinWidth" Value="{StaticResource StandardBoxMinWidth}"/> BasedOn="{StaticResource DefaultComboBoxStyle}"
TargetType="ComboBox">
<Setter Property="MinWidth" Value="{StaticResource StandardBoxMinWidth}" />
</Style> </Style>
<!--Text Box--> <!-- Text Box -->
<Style x:Key="TextBoxSettingStyle" TargetType="TextBox" BasedOn="{StaticResource DefaultTextBoxStyle}"> <Style x:Key="TextBoxSettingStyle"
<Setter Property="Width" Value="{StaticResource StandardBoxMinWidth}"/> BasedOn="{StaticResource DefaultTextBoxStyle}"
<Setter Property="HorizontalAlignment" Value="Left"/> TargetType="TextBox">
<Setter Property="TextWrapping" Value="Wrap"/> <Setter Property="Width" Value="{StaticResource StandardBoxMinWidth}" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="TextWrapping" Value="Wrap" />
</Style> </Style>
<!--Used for disclaimers--> <!-- Used for disclaimers -->
<Style x:Key="DisclaimerStyle" TargetType="TextBlock"> <Style x:Key="DisclaimerStyle"
<Setter Property="FontStyle" Value="Italic"/> TargetType="TextBlock">
<Setter Property="TextWrapping" Value="WrapWholeWords"/> <Setter Property="FontStyle" Value="Italic" />
<Setter Property="TextWrapping" Value="WrapWholeWords" />
</Style> </Style>
<!--Used for flyout messages--> <!-- Used for flyout messages -->
<Style x:Key="CustomFlyoutTextStyle" TargetType="TextBlock" BasedOn="{StaticResource BaseTextBlockStyle}"> <Style x:Key="CustomFlyoutTextStyle"
<Setter Property="FontWeight" Value="Bold"/> BasedOn="{StaticResource BaseTextBlockStyle}"
<Setter Property="Margin" Value="0,0,0,10"/> TargetType="TextBlock">
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="Margin" Value="0,0,0,10" />
</Style> </Style>
<!--Number Box--> <!-- Number Box -->
<Style x:Key="NumberBoxSettingStyle" TargetType="muxc:NumberBox"> <Style x:Key="NumberBoxSettingStyle"
<Setter Property="SpinButtonPlacementMode" Value="Compact"/> TargetType="muxc:NumberBox">
<Setter Property="HorizontalAlignment" Value="Left"/> <Setter Property="SpinButtonPlacementMode" Value="Compact" />
<Setter Property="HorizontalAlignment" Value="Left" />
</Style> </Style>
<!--Button-Related Styling--> <!-- Button-Related Styling -->
<Style x:Key="BaseButtonStyle" TargetType="Button" BasedOn="{StaticResource DefaultButtonStyle}"> <Style x:Key="BaseButtonStyle"
<Setter Property="VerticalAlignment" Value="Center"/> BasedOn="{StaticResource DefaultButtonStyle}"
TargetType="Button">
<Setter Property="VerticalAlignment" Value="Center" />
</Style> </Style>
<Style x:Key="BrowseButtonStyle" TargetType="Button" BasedOn="{StaticResource BaseButtonStyle}"> <Style x:Key="BrowseButtonStyle"
<Setter Property="Margin" Value="10,0,0,0"/> BasedOn="{StaticResource BaseButtonStyle}"
<Setter Property="Height" Value="33"/> TargetType="Button">
<Setter Property="Margin" Value="10,0,0,0" />
<Setter Property="Height" Value="33" />
</Style> </Style>
<Style x:Key="DeleteButtonStyle" TargetType="Button" BasedOn="{StaticResource BaseButtonStyle}"> <Style x:Key="DeleteButtonStyle"
<Setter Property="Margin" Value="0,0,0,10"/> BasedOn="{StaticResource BaseButtonStyle}"
TargetType="Button">
<Setter Property="Margin" Value="0,0,0,10" />
</Style> </Style>
<Style x:Key="SmallButtonStyle" TargetType="Button" BasedOn="{StaticResource BrowseButtonStyle}"> <Style x:Key="SmallButtonStyle"
<Setter Property="Height" Value="33"/> BasedOn="{StaticResource BrowseButtonStyle}"
<Setter Property="Width" Value="33"/> TargetType="Button">
<Setter Property="Height" Value="33" />
<Setter Property="Width" Value="33" />
</Style> </Style>
<Style x:Key="AccentBrowseButtonStyle" TargetType="Button" BasedOn="{StaticResource AccentButtonStyle}"> <Style x:Key="AccentBrowseButtonStyle"
<Setter Property="Margin" Value="10,0,0,0"/> BasedOn="{StaticResource AccentButtonStyle}"
<Setter Property="VerticalAlignment" Value="Bottom"/> TargetType="Button">
<Setter Property="Margin" Value="10,0,0,0" />
<Setter Property="VerticalAlignment" Value="Bottom" />
</Style> </Style>
<Style x:Key="AccentSmallButtonStyle" TargetType="Button" BasedOn="{StaticResource AccentButtonStyle}"> <Style x:Key="AccentSmallButtonStyle"
<Setter Property="Margin" Value="10,0,0,0"/> BasedOn="{StaticResource AccentButtonStyle}"
<Setter Property="VerticalAlignment" Value="Bottom"/> TargetType="Button">
<Setter Property="Height" Value="33"/> <Setter Property="Margin" Value="10,0,0,0" />
<Setter Property="Width" Value="33"/> <Setter Property="VerticalAlignment" Value="Bottom" />
<Setter Property="Height" Value="33" />
<Setter Property="Width" Value="33" />
</Style> </Style>
<Style x:Key="IconButtonTextBlockStyle" TargetType="TextBlock"> <Style x:Key="IconButtonTextBlockStyle"
<Setter Property="Margin" Value="10,0,0,0"/> TargetType="TextBlock">
<Setter Property="Margin" Value="10,0,0,0" />
</Style> </Style>
<!--Slider-Related Styling--> <!-- Slider-Related Styling -->
<Style x:Key="SliderValueLabelStyle" TargetType="TextBlock"> <Style x:Key="SliderValueLabelStyle"
<Setter Property="Width" Value="35"/> TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Left"/> <Setter Property="Width" Value="35" />
<Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="Margin" Value="5,0,0,0"/> <Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="5,0,0,0" />
</Style> </Style>
<Style x:Key="CustomSliderControlGridStyle" TargetType="Grid"> <Style x:Key="CustomSliderControlGridStyle"
<Setter Property="Width" Value="{StaticResource StandardBoxMinWidth}"/> TargetType="Grid">
<Setter Property="HorizontalAlignment" Value="Left"/> <Setter Property="Width" Value="{StaticResource StandardBoxMinWidth}" />
<Setter Property="HorizontalAlignment" Value="Left" />
</Style> </Style>
</ResourceDictionary> </ResourceDictionary>

View File

@ -1,70 +1,72 @@
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under <!--
the MIT License. See LICENSE in the project root for license information. --> Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
<Page the MIT License. See LICENSE in the project root for license information.
x:Class="Microsoft.Terminal.Settings.Editor.GlobalAppearance" -->
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" <Page x:Class="Microsoft.Terminal.Settings.Editor.GlobalAppearance"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:local="using:Microsoft.Terminal.Settings.Editor" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="using:Microsoft.Terminal.Settings.Editor"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"> xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
mc:Ignorable="d">
<Page.Resources> <Page.Resources>
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="CommonResources.xaml"/> <ResourceDictionary Source="CommonResources.xaml" />
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
<DataTemplate x:DataType="local:EnumEntry" x:Key="EnumRadioButtonTemplate"> <DataTemplate x:Key="EnumRadioButtonTemplate"
<RadioButton Content="{x:Bind EnumName, Mode=OneWay}"/> x:DataType="local:EnumEntry">
<RadioButton Content="{x:Bind EnumName, Mode=OneWay}" />
</DataTemplate> </DataTemplate>
<local:InvertedBooleanConverter x:Key="InvertedBooleanConverter"/> <local:InvertedBooleanConverter x:Key="InvertedBooleanConverter" />
</ResourceDictionary> </ResourceDictionary>
</Page.Resources> </Page.Resources>
<ScrollViewer> <ScrollViewer>
<StackPanel Style="{StaticResource SettingsStackStyle}"> <StackPanel Style="{StaticResource SettingsStackStyle}">
<!--Theme--> <!-- Theme -->
<local:SettingContainer x:Uid="Globals_Theme" <local:SettingContainer x:Uid="Globals_Theme"
Margin="0"> Margin="0">
<muxc:RadioButtons SelectedItem="{x:Bind CurrentTheme, Mode=TwoWay}" <muxc:RadioButtons ItemTemplate="{StaticResource EnumRadioButtonTemplate}"
ItemsSource="{x:Bind ThemeList, Mode=OneWay}" ItemsSource="{x:Bind ThemeList, Mode=OneWay}"
ItemTemplate="{StaticResource EnumRadioButtonTemplate}"/> SelectedItem="{x:Bind CurrentTheme, Mode=TwoWay}" />
</local:SettingContainer> </local:SettingContainer>
<!--Always show tabs--> <!-- Always show tabs -->
<local:SettingContainer x:Uid="Globals_AlwaysShowTabs"> <local:SettingContainer x:Uid="Globals_AlwaysShowTabs">
<ToggleSwitch IsOn="{x:Bind State.Globals.AlwaysShowTabs, Mode=TwoWay}"/> <ToggleSwitch IsOn="{x:Bind State.Globals.AlwaysShowTabs, Mode=TwoWay}" />
</local:SettingContainer> </local:SettingContainer>
<!--Show Titlebar--> <!-- Show Titlebar -->
<local:SettingContainer x:Uid="Globals_ShowTitlebar"> <local:SettingContainer x:Uid="Globals_ShowTitlebar">
<ToggleSwitch IsOn="{x:Bind State.Globals.ShowTabsInTitlebar, Mode=TwoWay}"/> <ToggleSwitch IsOn="{x:Bind State.Globals.ShowTabsInTitlebar, Mode=TwoWay}" />
</local:SettingContainer> </local:SettingContainer>
<!--Show Title in Titlebar--> <!-- Show Title in Titlebar -->
<local:SettingContainer x:Uid="Globals_ShowTitleInTitlebar"> <local:SettingContainer x:Uid="Globals_ShowTitleInTitlebar">
<ToggleSwitch IsOn="{x:Bind State.Globals.ShowTitleInTitlebar, Mode=TwoWay}"/> <ToggleSwitch IsOn="{x:Bind State.Globals.ShowTitleInTitlebar, Mode=TwoWay}" />
</local:SettingContainer> </local:SettingContainer>
<!--Always on Top--> <!-- Always on Top -->
<local:SettingContainer x:Uid="Globals_AlwaysOnTop"> <local:SettingContainer x:Uid="Globals_AlwaysOnTop">
<ToggleSwitch IsOn="{x:Bind State.Globals.AlwaysOnTop, Mode=TwoWay}"/> <ToggleSwitch IsOn="{x:Bind State.Globals.AlwaysOnTop, Mode=TwoWay}" />
</local:SettingContainer> </local:SettingContainer>
<!--Tab Width Mode--> <!-- Tab Width Mode -->
<local:SettingContainer x:Uid="Globals_TabWidthMode"> <local:SettingContainer x:Uid="Globals_TabWidthMode">
<muxc:RadioButtons SelectedItem="{x:Bind CurrentTabWidthMode, Mode=TwoWay}" <muxc:RadioButtons ItemTemplate="{StaticResource EnumRadioButtonTemplate}"
ItemsSource="{x:Bind TabWidthModeList, Mode=OneWay}" ItemsSource="{x:Bind TabWidthModeList, Mode=OneWay}"
ItemTemplate="{StaticResource EnumRadioButtonTemplate}"/> SelectedItem="{x:Bind CurrentTabWidthMode, Mode=TwoWay}" />
</local:SettingContainer> </local:SettingContainer>
<!--Disable Animations--> <!-- Disable Animations -->
<!-- NOTE: the UID is "DisablePaneAnimationsReversed" not "DisablePaneAnimations". See GH#9124 for more details. --> <!-- NOTE: the UID is "DisablePaneAnimationsReversed" not "DisablePaneAnimations". See GH#9124 for more details. -->
<local:SettingContainer x:Uid="Globals_DisableAnimationsReversed"> <local:SettingContainer x:Uid="Globals_DisableAnimationsReversed">
<ToggleSwitch IsOn="{x:Bind State.Globals.DisableAnimations, Mode=TwoWay, Converter={StaticResource InvertedBooleanConverter}}"/> <ToggleSwitch IsOn="{x:Bind State.Globals.DisableAnimations, Mode=TwoWay, Converter={StaticResource InvertedBooleanConverter}}" />
</local:SettingContainer> </local:SettingContainer>
</StackPanel> </StackPanel>
</ScrollViewer> </ScrollViewer>

View File

@ -1,63 +1,65 @@
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under <!--
the MIT License. See LICENSE in the project root for license information. --> Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
<Page the MIT License. See LICENSE in the project root for license information.
x:Class="Microsoft.Terminal.Settings.Editor.Interaction" -->
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" <Page x:Class="Microsoft.Terminal.Settings.Editor.Interaction"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:local="using:Microsoft.Terminal.Settings.Editor" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="using:Microsoft.Terminal.Settings.Editor"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"> xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
mc:Ignorable="d">
<Page.Resources> <Page.Resources>
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="CommonResources.xaml"/> <ResourceDictionary Source="CommonResources.xaml" />
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
<DataTemplate x:DataType="local:EnumEntry" x:Key="EnumRadioButtonTemplate"> <DataTemplate x:Key="EnumRadioButtonTemplate"
<RadioButton Content="{x:Bind EnumName, Mode=OneWay}"/> x:DataType="local:EnumEntry">
<RadioButton Content="{x:Bind EnumName, Mode=OneWay}" />
</DataTemplate> </DataTemplate>
</ResourceDictionary> </ResourceDictionary>
</Page.Resources> </Page.Resources>
<ScrollViewer> <ScrollViewer>
<StackPanel Style="{StaticResource SettingsStackStyle}"> <StackPanel Style="{StaticResource SettingsStackStyle}">
<!--Copy On Select--> <!-- Copy On Select -->
<local:SettingContainer x:Uid="Globals_CopyOnSelect" <local:SettingContainer x:Uid="Globals_CopyOnSelect"
Margin="0"> Margin="0">
<ToggleSwitch IsOn="{x:Bind State.Globals.CopyOnSelect, Mode=TwoWay}"/> <ToggleSwitch IsOn="{x:Bind State.Globals.CopyOnSelect, Mode=TwoWay}" />
</local:SettingContainer> </local:SettingContainer>
<!--Copy Format--> <!-- Copy Format -->
<local:SettingContainer x:Uid="Globals_CopyFormat"> <local:SettingContainer x:Uid="Globals_CopyFormat">
<muxc:RadioButtons ItemsSource="{x:Bind CopyFormatList, Mode=OneWay}" <muxc:RadioButtons ItemTemplate="{StaticResource EnumRadioButtonTemplate}"
SelectedItem="{x:Bind CurrentCopyFormat, Mode=TwoWay}" ItemsSource="{x:Bind CopyFormatList, Mode=OneWay}"
ItemTemplate="{StaticResource EnumRadioButtonTemplate}"/> SelectedItem="{x:Bind CurrentCopyFormat, Mode=TwoWay}" />
</local:SettingContainer> </local:SettingContainer>
<!--Word Delimiters--> <!-- Word Delimiters -->
<local:SettingContainer x:Uid="Globals_WordDelimiters"> <local:SettingContainer x:Uid="Globals_WordDelimiters">
<TextBox Text="{x:Bind State.Globals.WordDelimiters, Mode=TwoWay}" <TextBox Style="{StaticResource TextBoxSettingStyle}"
Style="{StaticResource TextBoxSettingStyle}"/> Text="{x:Bind State.Globals.WordDelimiters, Mode=TwoWay}" />
</local:SettingContainer> </local:SettingContainer>
<!--Snap On Resize--> <!-- Snap On Resize -->
<local:SettingContainer x:Uid="Globals_SnapToGridOnResize"> <local:SettingContainer x:Uid="Globals_SnapToGridOnResize">
<ToggleSwitch IsOn="{x:Bind State.Globals.SnapToGridOnResize, Mode=TwoWay}"/> <ToggleSwitch IsOn="{x:Bind State.Globals.SnapToGridOnResize, Mode=TwoWay}" />
</local:SettingContainer> </local:SettingContainer>
<!--Tab Switcher Mode--> <!-- Tab Switcher Mode -->
<local:SettingContainer x:Uid="Globals_TabSwitcherMode"> <local:SettingContainer x:Uid="Globals_TabSwitcherMode">
<muxc:RadioButtons SelectedItem="{x:Bind CurrentTabSwitcherMode, Mode=TwoWay}" <muxc:RadioButtons ItemTemplate="{StaticResource EnumRadioButtonTemplate}"
ItemsSource="{x:Bind TabSwitcherModeList}" ItemsSource="{x:Bind TabSwitcherModeList}"
ItemTemplate="{StaticResource EnumRadioButtonTemplate}"/> SelectedItem="{x:Bind CurrentTabSwitcherMode, Mode=TwoWay}" />
</local:SettingContainer> </local:SettingContainer>
<!-- Focus Follow Mouse Mode--> <!-- Focus Follow Mouse Mode -->
<local:SettingContainer x:Uid="Globals_FocusFollowMouse"> <local:SettingContainer x:Uid="Globals_FocusFollowMouse">
<ToggleSwitch IsOn="{x:Bind State.Globals.FocusFollowMouse, Mode=TwoWay}"/> <ToggleSwitch IsOn="{x:Bind State.Globals.FocusFollowMouse, Mode=TwoWay}" />
</local:SettingContainer> </local:SettingContainer>
</StackPanel> </StackPanel>
</ScrollViewer> </ScrollViewer>

View File

@ -1,30 +1,34 @@
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under <!--
the MIT License. See LICENSE in the project root for license information. --> Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
<Page the MIT License. See LICENSE in the project root for license information.
x:Class="Microsoft.Terminal.Settings.Editor.Launch" -->
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" <Page x:Class="Microsoft.Terminal.Settings.Editor.Launch"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:local="using:Microsoft.Terminal.Settings.Editor" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:SettingsModel="using:Microsoft.Terminal.Settings.Model"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls" xmlns:local="using:Microsoft.Terminal.Settings.Editor"
xmlns:SettingsModel="using:Microsoft.Terminal.Settings.Model" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"> xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
mc:Ignorable="d">
<Page.Resources> <Page.Resources>
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="CommonResources.xaml"/> <ResourceDictionary Source="CommonResources.xaml" />
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
<DataTemplate x:DataType="local:EnumEntry" x:Key="EnumRadioButtonTemplate"> <DataTemplate x:Key="EnumRadioButtonTemplate"
<RadioButton Content="{x:Bind EnumName, Mode=OneWay}"/> x:DataType="local:EnumEntry">
<RadioButton Content="{x:Bind EnumName, Mode=OneWay}" />
</DataTemplate> </DataTemplate>
<SettingsModel:IconPathConverter x:Key="IconSourceConverter"/> <SettingsModel:IconPathConverter x:Key="IconSourceConverter" />
<Style x:Key="LaunchSizeNumberBoxStyle" TargetType="muxc:NumberBox" BasedOn="{StaticResource NumberBoxSettingStyle}"> <Style x:Key="LaunchSizeNumberBoxStyle"
<Setter Property="SmallChange" Value="1"/> BasedOn="{StaticResource NumberBoxSettingStyle}"
<Setter Property="LargeChange" Value="10"/> TargetType="muxc:NumberBox">
<Setter Property="Minimum" Value="1"/> <Setter Property="SmallChange" Value="1" />
<Setter Property="LargeChange" Value="10" />
<Setter Property="Minimum" Value="1" />
</Style> </Style>
</ResourceDictionary> </ResourceDictionary>
</Page.Resources> </Page.Resources>
@ -32,7 +36,7 @@ the MIT License. See LICENSE in the project root for license information. -->
<ScrollViewer> <ScrollViewer>
<StackPanel> <StackPanel>
<StackPanel Style="{StaticResource SettingsStackStyle}"> <StackPanel Style="{StaticResource SettingsStackStyle}">
<!--Default Profile--> <!-- Default Profile -->
<local:SettingContainer x:Uid="Globals_DefaultProfile" <local:SettingContainer x:Uid="Globals_DefaultProfile"
Margin="0"> Margin="0">
<ComboBox x:Name="DefaultProfile" <ComboBox x:Name="DefaultProfile"
@ -41,25 +45,23 @@ the MIT License. See LICENSE in the project root for license information. -->
Style="{StaticResource ComboBoxSettingStyle}"> Style="{StaticResource ComboBoxSettingStyle}">
<ComboBox.ItemTemplate> <ComboBox.ItemTemplate>
<DataTemplate x:DataType="SettingsModel:Profile"> <DataTemplate x:DataType="SettingsModel:Profile">
<Grid HorizontalAlignment="Stretch" ColumnSpacing="8"> <Grid HorizontalAlignment="Stretch"
ColumnSpacing="8">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<!-- icon --> <!-- icon -->
<ColumnDefinition Width="16"/> <ColumnDefinition Width="16" />
<!-- profile name --> <!-- profile name -->
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<IconSourceElement <IconSourceElement Grid.Column="0"
Grid.Column="0" Width="16"
Width="16" Height="16"
Height="16" IconSource="{x:Bind Icon, Mode=OneWay, Converter={StaticResource IconSourceConverter}}" />
IconSource="{x:Bind Icon,
Mode=OneWay,
Converter={StaticResource IconSourceConverter}}"/>
<TextBlock Grid.Column="1" <TextBlock Grid.Column="1"
Text="{x:Bind Name}"/> Text="{x:Bind Name}" />
</Grid> </Grid>
</DataTemplate> </DataTemplate>
@ -67,52 +69,51 @@ the MIT License. See LICENSE in the project root for license information. -->
</ComboBox> </ComboBox>
</local:SettingContainer> </local:SettingContainer>
<!-- Default Terminal --> <!-- Default Terminal -->
<local:SettingContainer x:Uid="Globals_DefaultTerminal"> <local:SettingContainer x:Uid="Globals_DefaultTerminal">
<ComboBox x:Name="DefaultTerminal" <ComboBox x:Name="DefaultTerminal"
x:Load="False" x:Load="False"
ItemsSource="{x:Bind DefaultTerminals, Mode=OneWay}" ItemsSource="{x:Bind DefaultTerminals, Mode=OneWay}"
SelectedItem="{x:Bind CurrentDefaultTerminal, Mode=TwoWay}" SelectedItem="{x:Bind CurrentDefaultTerminal, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}"> Style="{StaticResource ComboBoxSettingStyle}" />
</ComboBox>
</local:SettingContainer> </local:SettingContainer>
<!--Start on User Login--> <!-- Start on User Login -->
<local:SettingContainer x:Uid="Globals_StartOnUserLogin"> <local:SettingContainer x:Uid="Globals_StartOnUserLogin">
<ToggleSwitch IsOn="{x:Bind State.Settings.GlobalSettings.StartOnUserLogin, Mode=TwoWay}"/> <ToggleSwitch IsOn="{x:Bind State.Settings.GlobalSettings.StartOnUserLogin, Mode=TwoWay}" />
</local:SettingContainer> </local:SettingContainer>
<!--Launch Mode--> <!-- Launch Mode -->
<local:SettingContainer x:Uid="Globals_LaunchMode"> <local:SettingContainer x:Uid="Globals_LaunchMode">
<muxc:RadioButtons SelectedItem="{x:Bind CurrentLaunchMode, Mode=TwoWay}" <muxc:RadioButtons ItemTemplate="{StaticResource EnumRadioButtonTemplate}"
ItemsSource="{x:Bind LaunchModeList}" ItemsSource="{x:Bind LaunchModeList}"
ItemTemplate="{StaticResource EnumRadioButtonTemplate}"/> SelectedItem="{x:Bind CurrentLaunchMode, Mode=TwoWay}" />
</local:SettingContainer> </local:SettingContainer>
<!--Launch Mode--> <!-- Launch Mode -->
<local:SettingContainer x:Uid="Globals_WindowingBehavior"> <local:SettingContainer x:Uid="Globals_WindowingBehavior">
<muxc:RadioButtons SelectedItem="{x:Bind CurrentWindowingBehavior, Mode=TwoWay}" <muxc:RadioButtons ItemTemplate="{StaticResource EnumRadioButtonTemplate}"
ItemsSource="{x:Bind WindowingBehaviorList}" ItemsSource="{x:Bind WindowingBehaviorList}"
ItemTemplate="{StaticResource EnumRadioButtonTemplate}"/> SelectedItem="{x:Bind CurrentWindowingBehavior, Mode=TwoWay}" />
</local:SettingContainer> </local:SettingContainer>
</StackPanel> </StackPanel>
<!--Launch Size--> <!-- Launch Size -->
<StackPanel Style="{StaticResource SettingsStackStyle}"> <StackPanel Style="{StaticResource SettingsStackStyle}">
<!--Header--> <!-- Header -->
<TextBlock x:Uid="Globals_LaunchSize" <TextBlock x:Uid="Globals_LaunchSize"
Style="{StaticResource SubtitleTextBlockStyle}"/> Style="{StaticResource SubtitleTextBlockStyle}" />
<!--Columns--> <!-- Columns -->
<local:SettingContainer x:Uid="Globals_InitialCols" <local:SettingContainer x:Uid="Globals_InitialCols"
Margin="0"> Margin="0">
<muxc:NumberBox Value="{x:Bind State.Settings.GlobalSettings.InitialCols, Mode=TwoWay}" <muxc:NumberBox Style="{StaticResource LaunchSizeNumberBoxStyle}"
Style="{StaticResource LaunchSizeNumberBoxStyle}"/> Value="{x:Bind State.Settings.GlobalSettings.InitialCols, Mode=TwoWay}" />
</local:SettingContainer> </local:SettingContainer>
<!--Rows--> <!-- Rows -->
<local:SettingContainer x:Uid="Globals_InitialRows"> <local:SettingContainer x:Uid="Globals_InitialRows">
<muxc:NumberBox Value="{x:Bind State.Settings.GlobalSettings.InitialRows, Mode=TwoWay}" <muxc:NumberBox Style="{StaticResource LaunchSizeNumberBoxStyle}"
Style="{StaticResource LaunchSizeNumberBoxStyle}"/> Value="{x:Bind State.Settings.GlobalSettings.InitialRows, Mode=TwoWay}" />
</local:SettingContainer> </local:SettingContainer>
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>

View File

@ -1,41 +1,42 @@
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under <!--
the MIT License. See LICENSE in the project root for license information. --> Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
<Page the MIT License. See LICENSE in the project root for license information.
x:Class="Microsoft.Terminal.Settings.Editor.MainPage" -->
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" <Page x:Class="Microsoft.Terminal.Settings.Editor.MainPage"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"> xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
mc:Ignorable="d">
<Page.Resources> <Page.Resources>
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="CommonResources.xaml"/> <ResourceDictionary Source="CommonResources.xaml" />
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
<AcrylicBrush x:Key="NavigationViewDefaultPaneBackground" <AcrylicBrush x:Key="NavigationViewDefaultPaneBackground"
BackgroundSource="Backdrop" BackgroundSource="Backdrop"
TintColor="{ThemeResource SystemChromeMediumColor}" TintColor="{ThemeResource SystemChromeMediumColor}"
TintOpacity="0.5"/> TintOpacity="0.5" />
<AcrylicBrush x:Key="NavigationViewTopPaneBackground" <AcrylicBrush x:Key="NavigationViewTopPaneBackground"
BackgroundSource="Backdrop" BackgroundSource="Backdrop"
TintColor="{ThemeResource SystemChromeMediumColor}" TintColor="{ThemeResource SystemChromeMediumColor}"
TintOpacity="0.5"/> TintOpacity="0.5" />
<AcrylicBrush x:Key="NavigationViewExpandedPaneBackground" <AcrylicBrush x:Key="NavigationViewExpandedPaneBackground"
BackgroundSource="HostBackdrop" BackgroundSource="HostBackdrop"
TintColor="{ThemeResource SystemChromeMediumColor}" TintColor="{ThemeResource SystemChromeMediumColor}"
TintOpacity="0.7"/> TintOpacity="0.7" />
</ResourceDictionary> </ResourceDictionary>
</Page.Resources> </Page.Resources>
<muxc:NavigationView x:Name="SettingsNav" <muxc:NavigationView x:Name="SettingsNav"
IsSettingsVisible="False"
Header="{Binding ElementName=SettingsNav, Path=SelectedItem.Content, Mode=OneWay}" Header="{Binding ElementName=SettingsNav, Path=SelectedItem.Content, Mode=OneWay}"
Loaded="SettingsNav_Loaded"
ItemInvoked="SettingsNav_ItemInvoked"
IsBackButtonVisible="Collapsed" IsBackButtonVisible="Collapsed"
IsSettingsVisible="False"
ItemInvoked="SettingsNav_ItemInvoked"
Loaded="SettingsNav_Loaded"
TabFocusNavigation="Cycle"> TabFocusNavigation="Cycle">
<muxc:NavigationView.MenuItems> <muxc:NavigationView.MenuItems>
@ -43,98 +44,102 @@ the MIT License. See LICENSE in the project root for license information. -->
<muxc:NavigationViewItem x:Uid="Nav_Launch" <muxc:NavigationViewItem x:Uid="Nav_Launch"
Tag="Launch_Nav"> Tag="Launch_Nav">
<muxc:NavigationViewItem.Icon> <muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE7B5;"/> <FontIcon Glyph="&#xE7B5;" />
</muxc:NavigationViewItem.Icon> </muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem> </muxc:NavigationViewItem>
<muxc:NavigationViewItem x:Uid="Nav_Interaction" <muxc:NavigationViewItem x:Uid="Nav_Interaction"
Tag="Interaction_Nav"> Tag="Interaction_Nav">
<muxc:NavigationViewItem.Icon> <muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE7C9;"/> <FontIcon Glyph="&#xE7C9;" />
</muxc:NavigationViewItem.Icon> </muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem> </muxc:NavigationViewItem>
<muxc:NavigationViewItem x:Uid="Nav_Appearance" <muxc:NavigationViewItem x:Uid="Nav_Appearance"
Tag="GlobalAppearance_Nav"> Tag="GlobalAppearance_Nav">
<muxc:NavigationViewItem.Icon> <muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE771;"/> <FontIcon Glyph="&#xE771;" />
</muxc:NavigationViewItem.Icon> </muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem> </muxc:NavigationViewItem>
<muxc:NavigationViewItem x:Uid="Nav_ColorSchemes" <muxc:NavigationViewItem x:Uid="Nav_ColorSchemes"
Tag="ColorSchemes_Nav"> Tag="ColorSchemes_Nav">
<muxc:NavigationViewItem.Icon> <muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE790;"/> <FontIcon Glyph="&#xE790;" />
</muxc:NavigationViewItem.Icon> </muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem> </muxc:NavigationViewItem>
<muxc:NavigationViewItem x:Uid="Nav_Rendering" <muxc:NavigationViewItem x:Uid="Nav_Rendering"
Tag="Rendering_Nav" > Tag="Rendering_Nav">
<muxc:NavigationViewItem.Icon> <muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE7F8;"/> <FontIcon Glyph="&#xE7F8;" />
</muxc:NavigationViewItem.Icon> </muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem> </muxc:NavigationViewItem>
<muxc:NavigationViewItem x:Uid="Nav_Actions" <muxc:NavigationViewItem x:Uid="Nav_Actions"
Tag="Actions_Nav" > Tag="Actions_Nav">
<muxc:NavigationViewItem.Icon> <muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE765;"/> <FontIcon Glyph="&#xE765;" />
</muxc:NavigationViewItem.Icon> </muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem> </muxc:NavigationViewItem>
<muxc:NavigationViewItemHeader x:Uid="Nav_Profiles"/> <muxc:NavigationViewItemHeader x:Uid="Nav_Profiles" />
<muxc:NavigationViewItem x:Uid="Nav_ProfileDefaults" <muxc:NavigationViewItem x:Name="BaseLayerMenuItem"
x:Name="BaseLayerMenuItem" x:Uid="Nav_ProfileDefaults"
Tag="GlobalProfile_Nav"> Tag="GlobalProfile_Nav">
<muxc:NavigationViewItem.Icon> <muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE81E;"/> <FontIcon Glyph="&#xE81E;" />
</muxc:NavigationViewItem.Icon> </muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem> </muxc:NavigationViewItem>
</muxc:NavigationView.MenuItems> </muxc:NavigationView.MenuItems>
<muxc:NavigationView.PaneFooter> <muxc:NavigationView.PaneFooter>
<!--The OpenJson item needs both Tapped and KeyDown handler--> <!-- The OpenJson item needs both Tapped and KeyDown handler -->
<muxc:NavigationViewItem x:Uid="Nav_OpenJSON" <muxc:NavigationViewItem x:Name="OpenJsonNavItem"
x:Name="OpenJsonNavItem" x:Uid="Nav_OpenJSON"
Tapped="OpenJsonTapped" KeyDown="OpenJsonKeyDown"
KeyDown="OpenJsonKeyDown"> Tapped="OpenJsonTapped">
<muxc:NavigationViewItem.Icon> <muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE713;"/> <FontIcon Glyph="&#xE713;" />
</muxc:NavigationViewItem.Icon> </muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem> </muxc:NavigationViewItem>
</muxc:NavigationView.PaneFooter> </muxc:NavigationView.PaneFooter>
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition> <RowDefinition Height="*" />
<RowDefinition Height="Auto"></RowDefinition> <RowDefinition Height="Auto" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Frame x:Name="contentFrame" <Frame x:Name="contentFrame"
Grid.Row="0"></Frame> Grid.Row="0" />
<Grid Height="100" Grid.Row="1" <Grid Grid.Row="1"
Height="100"
BorderBrush="{ThemeResource SystemBaseLowColor}" BorderBrush="{ThemeResource SystemBaseLowColor}"
BorderThickness="0,1,0,0"> BorderThickness="0,1,0,0">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBlock x:Uid="Settings_UnsavedSettingsWarning" <TextBlock x:Uid="Settings_UnsavedSettingsWarning"
Visibility="Collapsed" Margin="30,0,0,0"
Foreground="Goldenrod"
VerticalAlignment="Center"
HorizontalAlignment="Left" HorizontalAlignment="Left"
VerticalAlignment="Center"
Foreground="Goldenrod"
TextAlignment="Left" TextAlignment="Left"
Margin="30,0,0,0"/> Visibility="Collapsed" />
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Right" Orientation="Horizontal" Margin="0,0,30,0"> <StackPanel Margin="0,0,30,0"
<Button x:Uid="Settings_ResetSettingsButton" HorizontalAlignment="Right"
x:Name="ResetButton" VerticalAlignment="Center"
Click="ResetButton_Click"/> Orientation="Horizontal">
<Button x:Uid="Settings_SaveSettingsButton" <Button x:Name="ResetButton"
x:Name="SaveButton" x:Uid="Settings_ResetSettingsButton"
Style="{StaticResource AccentButtonStyle}" Click="ResetButton_Click" />
<Button x:Name="SaveButton"
x:Uid="Settings_SaveSettingsButton"
Margin="10,0,0,0" Margin="10,0,0,0"
Click="SaveButton_Click"/> Click="SaveButton_Click"
Style="{StaticResource AccentButtonStyle}" />
</StackPanel> </StackPanel>
</Grid> </Grid>
</Grid> </Grid>

File diff suppressed because it is too large Load Diff

View File

@ -1,35 +1,36 @@
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under <!--
the MIT License. See LICENSE in the project root for license information. --> Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
<Page the MIT License. See LICENSE in the project root for license information.
x:Class="Microsoft.Terminal.Settings.Editor.Rendering" -->
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" <Page x:Class="Microsoft.Terminal.Settings.Editor.Rendering"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:local="using:Microsoft.Terminal.Settings.Editor" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="using:Microsoft.Terminal.Settings.Editor"
mc:Ignorable="d"> xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Page.Resources> <Page.Resources>
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="CommonResources.xaml"/> <ResourceDictionary Source="CommonResources.xaml" />
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
</ResourceDictionary> </ResourceDictionary>
</Page.Resources> </Page.Resources>
<ScrollViewer> <ScrollViewer>
<StackPanel Style="{StaticResource SettingsStackStyle}"> <StackPanel Style="{StaticResource SettingsStackStyle}">
<TextBlock x:Uid="Globals_RenderingDisclaimer" <TextBlock x:Uid="Globals_RenderingDisclaimer"
Style="{StaticResource DisclaimerStyle}"/> Style="{StaticResource DisclaimerStyle}" />
<!--Force Full Repaint--> <!-- Force Full Repaint -->
<local:SettingContainer x:Uid="Globals_ForceFullRepaint"> <local:SettingContainer x:Uid="Globals_ForceFullRepaint">
<ToggleSwitch IsOn="{x:Bind State.Globals.ForceFullRepaintRendering, Mode=TwoWay}"/> <ToggleSwitch IsOn="{x:Bind State.Globals.ForceFullRepaintRendering, Mode=TwoWay}" />
</local:SettingContainer> </local:SettingContainer>
<!--Software Rendering--> <!-- Software Rendering -->
<local:SettingContainer x:Uid="Globals_SoftwareRendering"> <local:SettingContainer x:Uid="Globals_SoftwareRendering">
<ToggleSwitch IsOn="{x:Bind State.Globals.SoftwareRendering, Mode=TwoWay}"/> <ToggleSwitch IsOn="{x:Bind State.Globals.SoftwareRendering, Mode=TwoWay}" />
</local:SettingContainer> </local:SettingContainer>
</StackPanel> </StackPanel>
</ScrollViewer> </ScrollViewer>

View File

@ -1,52 +1,56 @@
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under <!--
the MIT License. See LICENSE in the project root for license information. --> Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
<ResourceDictionary the MIT License. See LICENSE in the project root for license information.
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" -->
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:local="using:Microsoft.Terminal.Settings.Editor" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="using:Microsoft.Terminal.Settings.Editor"
mc:Ignorable="d"> xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Style x:Key="SettingContainerHeaderStyle" TargetType="StackPanel"> <Style x:Key="SettingContainerHeaderStyle"
<Setter Property="Orientation" Value="Horizontal"/> TargetType="StackPanel">
<Setter Property="Margin" Value="0,0,0,4"/> <Setter Property="Orientation" Value="Horizontal" />
<Setter Property="Margin" Value="0,0,0,4" />
</Style> </Style>
<Style x:Key="SettingContainerResetButtonStyle" TargetType="Button"> <Style x:Key="SettingContainerResetButtonStyle"
<Setter Property="Margin" Value="5,0,0,0"/> TargetType="Button">
<Setter Property="Height" Value="19"/> <Setter Property="Margin" Value="5,0,0,0" />
<Setter Property="Width" Value="19"/> <Setter Property="Height" Value="19" />
<Setter Property="Padding" Value="0"/> <Setter Property="Width" Value="19" />
<Setter Property="Background" Value="Transparent"/> <Setter Property="Padding" Value="0" />
<Setter Property="Background" Value="Transparent" />
</Style> </Style>
<Style x:Key="SettingContainerFontIconStyle" TargetType="FontIcon"> <Style x:Key="SettingContainerFontIconStyle"
<Setter Property="Foreground" Value="{StaticResource SystemAccentColor}"/> TargetType="FontIcon">
<Setter Property="FontSize" Value="14"/> <Setter Property="Foreground" Value="{StaticResource SystemAccentColor}" />
<Setter Property="FontFamily" Value="Segoe MDL2 Assets"/> <Setter Property="FontSize" Value="14" />
<Setter Property="FontFamily" Value="Segoe MDL2 Assets" />
</Style> </Style>
<Style TargetType="local:SettingContainer"> <Style TargetType="local:SettingContainer">
<Setter Property="Margin" Value="0,24,0,0"/> <Setter Property="Margin" Value="0,24,0,0" />
<Setter Property="IsTabStop" Value="False"/> <Setter Property="IsTabStop" Value="False" />
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="local:SettingContainer"> <ControlTemplate TargetType="local:SettingContainer">
<StackPanel> <StackPanel>
<!--Header space--> <!-- Header space -->
<StackPanel Style="{StaticResource SettingContainerHeaderStyle}"> <StackPanel Style="{StaticResource SettingContainerHeaderStyle}">
<TextBlock Text="{TemplateBinding Header}"/> <TextBlock Text="{TemplateBinding Header}" />
<Button x:Name="ResetButton" <Button x:Name="ResetButton"
Style="{StaticResource SettingContainerResetButtonStyle}"> Style="{StaticResource SettingContainerResetButtonStyle}">
<FontIcon Glyph="&#xE845;" <FontIcon Glyph="&#xE845;"
Style="{StaticResource SettingContainerFontIconStyle}"/> Style="{StaticResource SettingContainerFontIconStyle}" />
</Button> </Button>
</StackPanel> </StackPanel>
<!--This is where the actual setting control will go--> <!-- This is where the actual setting control will go -->
<ContentPresenter Content="{TemplateBinding Content}"/> <ContentPresenter Content="{TemplateBinding Content}" />
</StackPanel> </StackPanel>
</ControlTemplate> </ControlTemplate>
</Setter.Value> </Setter.Value>

View File

@ -1,19 +1,23 @@
<UserControl x:Class="Microsoft.Terminal.Wpf.TerminalControl" <UserControl x:Class="Microsoft.Terminal.Wpf.TerminalControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Microsoft.Terminal.Wpf" xmlns:local="clr-namespace:Microsoft.Terminal.Wpf"
mc:Ignorable="d" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="450" d:DesignWidth="800" x:Name="terminalUserControl"
d:DesignHeight="450"
d:DesignWidth="800"
Focusable="True" Focusable="True"
x:Name="terminalUserControl"> mc:Ignorable="d">
<Grid x:Name="terminalGrid"> <Grid x:Name="terminalGrid">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition /> <ColumnDefinition />
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<local:TerminalContainer x:Name="termContainer"/> <local:TerminalContainer x:Name="termContainer" />
<ScrollBar x:Name="scrollbar" Scroll="Scrollbar_Scroll" SmallChange="1" Grid.Column="1" /> <ScrollBar x:Name="scrollbar"
Grid.Column="1"
Scroll="Scrollbar_Scroll"
SmallChange="1" />
</Grid> </Grid>
</UserControl> </UserControl>

View File

@ -1,9 +1,7 @@
<Application x:Class="WpfTerminalTestNetCore.App" <Application x:Class="WpfTerminalTestNetCore.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WpfTerminalTestNetCore" xmlns:local="clr-namespace:WpfTerminalTestNetCore"
StartupUri="MainWindow.xaml"> StartupUri="MainWindow.xaml">
<Application.Resources> <Application.Resources />
</Application.Resources>
</Application> </Application>

View File

@ -1,13 +1,16 @@
<Window x:Class="WpfTerminalTestNetCore.MainWindow" <Window x:Class="WpfTerminalTestNetCore.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfTerminalTestNetCore" xmlns:local="clr-namespace:WpfTerminalTestNetCore"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:term="clr-namespace:Microsoft.Terminal.Wpf;assembly=Microsoft.Terminal.Wpf" xmlns:term="clr-namespace:Microsoft.Terminal.Wpf;assembly=Microsoft.Terminal.Wpf"
mc:Ignorable="d" Title="MainWindow"
Title="MainWindow" Height="450" Width="800"> Width="800"
Height="450"
mc:Ignorable="d">
<Grid> <Grid>
<term:TerminalControl x:Name="Terminal" Focusable="true" /> <term:TerminalControl x:Name="Terminal"
Focusable="true" />
</Grid> </Grid>
</Window> </Window>

View File

@ -92,7 +92,7 @@ function Set-MsbuildDevEnvironment
Write-Verbose 'Setting up environment variables' Write-Verbose 'Setting up environment variables'
Enter-VsDevShell -VsInstallPath $vspath -SkipAutomaticLocation ` Enter-VsDevShell -VsInstallPath $vspath -SkipAutomaticLocation `
-devCmdArguments "-arch=$arch" | Out-Null -devCmdArguments "-arch=$arch" | Out-Null
Set-Item -Force -path "Env:\Platform" -Value $arch Set-Item -Force -path "Env:\Platform" -Value $arch
Write-Host "Dev environment variables set" -ForegroundColor Green Write-Host "Dev environment variables set" -ForegroundColor Green
@ -364,8 +364,56 @@ function Invoke-ClangFormat {
} }
#.SYNOPSIS #.SYNOPSIS
# runs code formatting on all c++ files # Check that xaml files are formatted correctly. This won't actually
# format the files - it'll only ensure that they're formatted correctly.
function Verify-XamlFormat() {
$root = Find-OpenConsoleRoot
& dotnet tool restore --add-source https://api.nuget.org/v3/index.json
$xamlsForStyler = (git ls-files **/*.xaml) -join ","
dotnet tool run xstyler -- -c "$root\XamlStyler.json" -f "$xamlsForStyler" --passive
if ($lastExitCode -eq 1) {
throw "Xaml formatting bad, run Invoke-XamlFormat on branch"
}
}
#.SYNOPSIS
# run xstyler on xaml files. Note that this will `touch` every file,
# even if there's nothing to do for a given file.
function Invoke-XamlFormat() {
$root = Find-OpenConsoleRoot
& dotnet tool restore --add-source https://api.nuget.org/v3/index.json
# xstyler lets you pass multiple xaml files in the -f param if they're all
# joined by commas. The `git ls-files` command will only get us the .xaml
# files actually in the git repo, ignoring ones in "Generated Files/"
$xamlsForStyler = (git ls-files **/*.xaml) -join ","
dotnet tool run xstyler -- -c "$root\XamlStyler.json" -f "$xamlsForStyler"
# Strip BOMs from all the .xaml files
$xamls = (git ls-files **/*.xaml)
foreach ($file in $xamls ) {
$content = Get-Content $file
[IO.File]::WriteAllLines("$root/$file", $content)
}
}
#.SYNOPSIS
# runs code formatting on all c++ and .xaml files.
#
#.PARAMETER IgnoreXaml
# When set, don't format XAML files. The CI needs this so
# Invoke-CheckBadCodeFormatting won't touch all the .xaml files.
function Invoke-CodeFormat() { function Invoke-CodeFormat() {
[CmdletBinding()]
Param (
[parameter(Mandatory=$false)]
[switch]$IgnoreXaml
)
$root = Find-OpenConsoleRoot $root = Find-OpenConsoleRoot
& "$root\dep\nuget\nuget.exe" restore "$root\tools\packages.config" & "$root\dep\nuget\nuget.exe" restore "$root\tools\packages.config"
$clangPackage = ([xml](Get-Content "$root\tools\packages.config")).packages.package | Where-Object id -like "clang-format*" $clangPackage = ([xml](Get-Content "$root\tools\packages.config")).packages.package | Where-Object id -like "clang-format*"
@ -373,6 +421,13 @@ function Invoke-CodeFormat() {
Get-ChildItem -Recurse "$root\src" -Include *.cpp, *.hpp, *.h | Get-ChildItem -Recurse "$root\src" -Include *.cpp, *.hpp, *.h |
Where FullName -NotLike "*Generated Files*" | Where FullName -NotLike "*Generated Files*" |
Invoke-ClangFormat -ClangFormatPath $clangFormatPath Invoke-ClangFormat -ClangFormatPath $clangFormatPath
if ($IgnoreXaml) {
# do nothing
}
else {
Invoke-XamlFormat
}
} }
Export-ModuleMember -Function Set-MsbuildDevEnvironment,Invoke-OpenConsoleTests,Invoke-OpenConsoleBuild,Start-OpenConsole,Debug-OpenConsole,Invoke-CodeFormat Export-ModuleMember -Function Set-MsbuildDevEnvironment,Invoke-OpenConsoleTests,Invoke-OpenConsoleBuild,Start-OpenConsole,Debug-OpenConsole,Invoke-CodeFormat,Invoke-XamlFormat,Verify-XamlFormat

View File

@ -38,9 +38,68 @@ for Linux entrypoint) in your `~` directory.
Likewise, `openps` launches powershell. Likewise, `openps` launches powershell.
## runformat ## runformat & runxamlformat
`runformat` will format the c++ code to match our coding style. `runxamlformat` will format `.xaml` files to match our coding style. `runformat`
will format the c++ code (and will also call `runxamlformat`). **`runformat`
should be called before making a new PR**, to ensure that code is formatted
correctly. If it isn't, the CI will prevent your PR from merging.
The C++ code is formatted with `clang-format`. Many editors have built-in
support for automatically running clang-format on save.
Our XAML code is formatted with
[XamlStyler](https://github.com/Xavalon/XamlStyler). I don't have a good way of
running this on save, but you can add a `git` hook to format before committing
`.xaml` files. To do so, add the following to your `.git/hooks/pre-commit` file:
```sh
# XAML Styler - xstyler.exe pre-commit Git Hook
# Documentation: https://github.com/Xavalon/XamlStyler/wiki
# Originally from https://github.com/Xavalon/XamlStyler/wiki/Git-Hook
# Define path to xstyler.exe
XSTYLER_PATH="dotnet tool run xstyler --"
# Define path to XAML Styler configuration
XSTYLER_CONFIG="../../XamlStyler.json"
echo "Running XAML Styler on committed XAML files"
git diff --cached --name-only --diff-filter=ACM | grep -e '\.xaml$' | \
# Wrap in brackets to preserve variable through loop
{
files=""
# Build list of files to pass to xstyler.exe
while read FILE; do
if [ "$files" == "" ]; then
files="$FILE";
else
files="$files,$FILE";
fi
done
if [ "$files" != "" ]; then
# Check if external configuration is specified
[ -z "$XSTYLER_CONFIG" ] && configParam="" || configParam="-c $XSTYLER_CONFIG"
# Format XAML files
$XSTYLER_PATH -f "$files" $configParam
for i in $(echo $files | sed "s/,/ /g")
do
#strip BOM
sed -i '1s/^\xEF\xBB\xBF//' $i
unix2dos $i
# stage updated file
git add -u $i
done
else
echo "No XAML files detected in commit"
fi
exit 0
}
```
## testcon, runut, runft ## testcon, runut, runft
`runut` will automatically run all of the unit tests through TAEF. `runft` will `runut` will automatically run all of the unit tests through TAEF. `runft` will

5
tools/runxamlformat.cmd Normal file
View File

@ -0,0 +1,5 @@
@echo off
rem run xstyler on xaml files
powershell -noprofile "import-module %OPENCON_TOOLS%\openconsole.psm1; Invoke-XamlFormat"