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/
^\.gitignore$
^doc/reference/master-sequence-list.csv$
^\XamlStyler.json$

View File

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

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<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.
function Invoke-CheckBadCodeFormatting() {
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
git diff-index --quiet HEAD --
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"
}
# Manually check the formatting of our .xaml files, without touching them.
Verify-XamlFormat
}
Invoke-CheckBadCodeFormatting

View File

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

View File

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

View File

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

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. -->
<Toolkit:XamlApplication
x:Class="TerminalApp.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:TerminalApp"
xmlns:Toolkit="using:Microsoft.Toolkit.Win32.UI.XamlHost"
xmlns:TA="using:TerminalApp"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<!-- If you want to prove this works, then add `RequestedTheme="Light"` to
the properties on the XamlApplication -->
<!--
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
the MIT License. See LICENSE in the project root for license information.
-->
<Toolkit:XamlApplication x:Class="TerminalApp.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:TA="using:TerminalApp"
xmlns:Toolkit="using:Microsoft.Toolkit.Win32.UI.XamlHost"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:TerminalApp"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<!--
If you want to prove this works, then add `RequestedTheme="Light"` to
the properties on the XamlApplication
-->
<Toolkit:XamlApplication.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!-- Include the MUX Controls resources -->
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls"/>
<!-- Include the MUX Controls resources -->
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
<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
`Background` property to "{ThemeResource
ApplicationPageBackgroundThemeBrush}" so it will be colored
appropriately for the theme, regardless of what we set the
RequestedTheme to -->
<Style x:Name="BackgroundGridThemeStyle" TargetType="Grid">
<!--
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
`Background` property to "{ThemeResource
ApplicationPageBackgroundThemeBrush}" so it will be colored
appropriately for the theme, regardless of what we set the
RequestedTheme to
-->
<Style x:Name="BackgroundGridThemeStyle"
TargetType="Grid">
<Setter Property="Background" Value="{ThemeResource ApplicationPageBackgroundThemeBrush}" />
</Style>
<!-- We need to manually create the error text brush as a
theme-dependent brush. SystemControlErrorTextForegroundBrush
is unfortunately static. -->
<SolidColorBrush x:Name="ErrorTextBrush" Color="{ThemeResource SystemErrorTextColor}" />
<!--
We need to manually create the error text brush as a
theme-dependent brush. SystemControlErrorTextForegroundBrush
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>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Dark">
<!-- Define resources for Dark mode here -->
<SolidColorBrush x:Key="TabViewBackground" Color="#FF333333" />
<!-- Define resources for Dark mode here -->
<SolidColorBrush x:Key="TabViewBackground"
Color="#FF333333" />
</ResourceDictionary>
<ResourceDictionary x:Key="Light">
<!-- Define resources for Light mode here -->
<SolidColorBrush x:Key="TabViewBackground" Color="#FFCCCCCC" />
<!-- Define resources for Light mode here -->
<SolidColorBrush x:Key="TabViewBackground"
Color="#FFCCCCCC" />
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>

View File

@ -1,146 +1,193 @@
<Flyout
x:Class="TerminalApp.ColorPickupFlyout"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:TerminalApp"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Flyout x:Class="TerminalApp.ColorPickupFlyout"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:TerminalApp"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Flyout.FlyoutPresenterStyle>
<Style TargetType="FlyoutPresenter">
<Setter Property="MinWidth" Value="0"/>
<Setter Property="MinWidth" Value="0" />
</Style>
</Flyout.FlyoutPresenterStyle>
<StackPanel Orientation="Horizontal">
<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>
<Style TargetType="Rectangle">
<Setter Property="Width" Value="30"/>
<Setter Property="Height" Value="30"/>
<Setter Property="Width" Value="30" />
<Setter Property="Height" Value="30" />
</Style>
<Style TargetType="Button">
<Setter Property="Padding" Value="0"/>
<Setter Property="Margin" Value="2"/>
<Setter Property="Padding" Value="0" />
<Setter Property="Margin" Value="2" />
</Style>
</VariableSizedWrapGrid.Resources>
<Button Click="ColorButton_Click" AutomationProperties.Name="Crimson" x:Uid="CrimsonColorButton">
<Button x:Uid="CrimsonColorButton"
AutomationProperties.Name="Crimson"
Click="ColorButton_Click">
<Button.Content>
<Rectangle Fill="Crimson"/>
<Rectangle Fill="Crimson" />
</Button.Content>
</Button>
<Button Click="ColorButton_Click" AutomationProperties.Name="SteelBlue" x:Uid="SteelBlueColorButton">
<Button x:Uid="SteelBlueColorButton"
AutomationProperties.Name="SteelBlue"
Click="ColorButton_Click">
<Button.Content>
<Rectangle Fill="SteelBlue"/>
<Rectangle Fill="SteelBlue" />
</Button.Content>
</Button>
<Button Click="ColorButton_Click" AutomationProperties.Name="MediumSeaGreen" x:Uid="MediumSeaGreenColorButton">
<Button x:Uid="MediumSeaGreenColorButton"
AutomationProperties.Name="MediumSeaGreen"
Click="ColorButton_Click">
<Button.Content>
<Rectangle Fill="MediumSeaGreen"/>
<Rectangle Fill="MediumSeaGreen" />
</Button.Content>
</Button>
<Button Click="ColorButton_Click" AutomationProperties.Name="DarkOrange" x:Uid="DarkOrangeColorButton">
<Button x:Uid="DarkOrangeColorButton"
AutomationProperties.Name="DarkOrange"
Click="ColorButton_Click">
<Button.Content>
<Rectangle Fill="DarkOrange"/>
<Rectangle Fill="DarkOrange" />
</Button.Content>
</Button>
<Button Click="ColorButton_Click" AutomationProperties.Name="MediumVioletRed" x:Uid="MediumVioletRedColorButton">
<Button x:Uid="MediumVioletRedColorButton"
AutomationProperties.Name="MediumVioletRed"
Click="ColorButton_Click">
<Button.Content>
<Rectangle Fill="MediumVioletRed"/>
<Rectangle Fill="MediumVioletRed" />
</Button.Content>
</Button>
<Button Click="ColorButton_Click" AutomationProperties.Name="DodgerBlue" x:Uid="DodgerBlueColorButton">
<Button x:Uid="DodgerBlueColorButton"
AutomationProperties.Name="DodgerBlue"
Click="ColorButton_Click">
<Button.Content>
<Rectangle Fill="DodgerBlue"/>
<Rectangle Fill="DodgerBlue" />
</Button.Content>
</Button>
<Button Click="ColorButton_Click" AutomationProperties.Name="LimeGreen" x:Uid="LimeGreenColorButton">
<Button x:Uid="LimeGreenColorButton"
AutomationProperties.Name="LimeGreen"
Click="ColorButton_Click">
<Button.Content>
<Rectangle Fill="LimeGreen"/>
<Rectangle Fill="LimeGreen" />
</Button.Content>
</Button>
<Button Click="ColorButton_Click" AutomationProperties.Name="Yellow" x:Uid="YellowColorButton">
<Button x:Uid="YellowColorButton"
AutomationProperties.Name="Yellow"
Click="ColorButton_Click">
<Button.Content>
<Rectangle Fill="Yellow"/>
<Rectangle Fill="Yellow" />
</Button.Content>
</Button>
<Button Click="ColorButton_Click" AutomationProperties.Name="BlueViolet" x:Uid="BlueVioletColorButton">
<Button x:Uid="BlueVioletColorButton"
AutomationProperties.Name="BlueViolet"
Click="ColorButton_Click">
<Button.Content>
<Rectangle Fill="BlueViolet"/>
<Rectangle Fill="BlueViolet" />
</Button.Content>
</Button>
<Button Click="ColorButton_Click" AutomationProperties.Name="SlateBlue" x:Uid="SlateBlueColorButton">
<Button x:Uid="SlateBlueColorButton"
AutomationProperties.Name="SlateBlue"
Click="ColorButton_Click">
<Button.Content>
<Rectangle Fill="SlateBlue"/>
<Rectangle Fill="SlateBlue" />
</Button.Content>
</Button>
<Button Click="ColorButton_Click" AutomationProperties.Name="Lime" x:Uid="LimeColorButton">
<Button x:Uid="LimeColorButton"
AutomationProperties.Name="Lime"
Click="ColorButton_Click">
<Button.Content>
<Rectangle Fill="Lime"/>
<Rectangle Fill="Lime" />
</Button.Content>
</Button>
<Button Click="ColorButton_Click" AutomationProperties.Name="Tan" x:Uid="TanColorButton">
<Button x:Uid="TanColorButton"
AutomationProperties.Name="Tan"
Click="ColorButton_Click">
<Button.Content>
<Rectangle Fill="Tan"/>
<Rectangle Fill="Tan" />
</Button.Content>
</Button>
<Button Click="ColorButton_Click" AutomationProperties.Name="Magenta" x:Uid="MagentaColorButton">
<Button x:Uid="MagentaColorButton"
AutomationProperties.Name="Magenta"
Click="ColorButton_Click">
<Button.Content>
<Rectangle Fill="Magenta"/>
<Rectangle Fill="Magenta" />
</Button.Content>
</Button>
<Button Click="ColorButton_Click" AutomationProperties.Name="Cyan" x:Uid="CyanColorButton">
<Button x:Uid="CyanColorButton"
AutomationProperties.Name="Cyan"
Click="ColorButton_Click">
<Button.Content>
<Rectangle Fill="Cyan"/>
<Rectangle Fill="Cyan" />
</Button.Content>
</Button>
<Button Click="ColorButton_Click" AutomationProperties.Name="SkyBlue" x:Uid="SkyBlueColorButton">
<Button x:Uid="SkyBlueColorButton"
AutomationProperties.Name="SkyBlue"
Click="ColorButton_Click">
<Button.Content>
<Rectangle Fill="SkyBlue"/>
<Rectangle Fill="SkyBlue" />
</Button.Content>
</Button>
<Button Click="ColorButton_Click" AutomationProperties.Name="DarkGray" x:Uid="DarkGrayColorButton">
<Button x:Uid="DarkGrayColorButton"
AutomationProperties.Name="DarkGray"
Click="ColorButton_Click">
<Button.Content>
<Rectangle Fill="DarkGray"/>
<Rectangle Fill="DarkGray" />
</Button.Content>
</Button>
</VariableSizedWrapGrid>
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
<StackPanel HorizontalAlignment="Center"
Orientation="Horizontal">
<StackPanel.Resources>
<Style TargetType="Button">
<Setter Property="Margin" Value="2" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
</Style>
</StackPanel.Resources>
<Button Padding="5"
Click="ClearColorButton_Click"
x:Name="ClearColorButton" x:Uid="TabColorClearButton" CornerRadius="2" Content="Reset">
</Button>
<Button Padding="5"
Click="ShowColorPickerButton_Click"
x:Name="CustomColorButton" x:Uid="TabColorCustomButton" CornerRadius="2" Content="Custom...">
</Button>
<Button x:Name="ClearColorButton"
x:Uid="TabColorClearButton"
Padding="5"
Click="ClearColorButton_Click"
Content="Reset"
CornerRadius="2" />
<Button x:Name="CustomColorButton"
x:Uid="TabColorCustomButton"
Padding="5"
Click="ShowColorPickerButton_Click"
Content="Custom..."
CornerRadius="2" />
</StackPanel>
</StackPanel>
<Grid Visibility="Collapsed" x:Name="customColorPanel" Margin="5">
<Grid x:Name="customColorPanel"
Margin="5"
Visibility="Collapsed">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<ColorPicker x:Name="customColorPicker"
IsMoreButtonVisible="True"
IsColorSliderVisible="True"
IsColorChannelTextInputVisible="True"
IsHexInputVisible="True"
IsAlphaEnabled="False"
IsAlphaSliderVisible="False"
IsAlphaTextInputVisible="False"
FontSize="10"
Grid.Row="0"
ColorChanged="ColorPicker_ColorChanged"
>
</ColorPicker>
<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="0"
ColorChanged="ColorPicker_ColorChanged"
FontSize="10"
IsAlphaEnabled="False"
IsAlphaSliderVisible="False"
IsAlphaTextInputVisible="False"
IsColorChannelTextInputVisible="True"
IsColorSliderVisible="True"
IsHexInputVisible="True"
IsMoreButtonVisible="True" />
<Button x:Name="OkButton"
x:Uid="OkButton"
Grid.Row="1"
MinWidth="130"
MinHeight="12"
Margin="0,5,0,0"
HorizontalAlignment="Center"
Click="CustomColorButton_Click"
Content="**OK**" />
</Grid>
</StackPanel>
</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. -->
<UserControl
x:Class="TerminalApp.CommandPalette"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:TerminalApp"
xmlns:model="using:Microsoft.Terminal.Settings.Model"
xmlns:mux="using:Microsoft.UI.Xaml.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Windows10version1903="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 8)"
xmlns:SettingsModel="using:Microsoft.Terminal.Settings.Model"
TabNavigation="Cycle"
IsTabStop="True"
AllowFocusOnInteraction="True"
PointerPressed="_rootPointerPressed"
PreviewKeyDown="_previewKeyDownHandler"
PreviewKeyUp="_keyUpHandler"
LostFocus="_lostFocusHandler"
mc:Ignorable="d"
AutomationProperties.Name="{x:Bind ControlName, Mode=OneWay}">
<UserControl.Resources>
<ResourceDictionary>
<!-- ThemeShadow is only on 18362. This "Windows10version1903" bit
adds it conditionally -->
<Windows10version1903:ThemeShadow x:Name="CommandPaletteShadow" />
<!-- This creates an instance of our CommandKeyChordVisibilityConverter we can reference below -->
<local:EmptyStringVisibilityConverter x:Key="CommandKeyChordVisibilityConverter"/>
<local:EmptyStringVisibilityConverter x:Key="ParsedCommandLineTextVisibilityConverter"/>
<local:EmptyStringVisibilityConverter x:Key="ParentCommandVisibilityConverter"/>
<model:IconPathConverter x:Key="IconSourceConverter"/>
<DataTemplate x:Key="ListItemTemplate" x:DataType="local:FilteredCommand">
<ListViewItem HorizontalContentAlignment="Stretch"
AutomationProperties.Name="{x:Bind Item.Name, Mode=OneWay}"
AutomationProperties.AcceleratorKey="{x:Bind Item.KeyChordText, Mode=OneWay}"/>
</DataTemplate>
<DataTemplate x:Key="GeneralItemTemplate" x:DataType="local:FilteredCommand">
<Grid HorizontalAlignment="Stretch" ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="16"/>
<!-- icon -->
<ColumnDefinition Width="Auto"/>
<!-- command label -->
<ColumnDefinition Width="*"/>
<!-- key chord -->
<ColumnDefinition Width="16"/>
<!-- gutter for scrollbar -->
</Grid.ColumnDefinitions>
<IconSourceElement
Grid.Column="0"
Width="16"
Height="16"
IconSource="{x:Bind Item.Icon,
Mode=OneWay,
Converter={StaticResource IconSourceConverter}}"/>
<local:HighlightedTextControl
Grid.Column="1"
HorizontalAlignment="Left"
Text="{x:Bind HighlightedName, Mode=OneWay}"/>
<!-- The block for the key chord is only visible
when there's actual text set as the label. See
CommandKeyChordVisibilityConverter for details.
We're setting the accessibility view on the
border and text block to Raw because otherwise,
Narrator will read out the key chord. Problem is,
it already did that because it was the list item's
"AcceleratorKey". It's redundant. -->
<Border
Grid.Column="2"
Visibility="{x:Bind Item.KeyChordText,
Mode=OneWay,
Converter={StaticResource CommandKeyChordVisibilityConverter}}"
Style="{ThemeResource KeyChordBorderStyle}"
Padding="2,0,2,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
AutomationProperties.AccessibilityView="Raw">
<TextBlock
Style="{ThemeResource KeyChordTextBlockStyle}"
FontSize="12"
Text="{x:Bind Item.KeyChordText, Mode=OneWay}"
AutomationProperties.AccessibilityView="Raw" />
</Border>
</Grid>
</DataTemplate>
<DataTemplate x:Key="NestedItemTemplate" x:DataType="local:FilteredCommand">
<Grid HorizontalAlignment="Stretch" ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="16"/>
<!-- icon -->
<ColumnDefinition Width="Auto"/>
<!-- command label -->
<ColumnDefinition Width="*"/>
<!-- key chord -->
<ColumnDefinition Width="16"/>
<!-- gutter for scrollbar -->
</Grid.ColumnDefinitions>
<IconSourceElement
Grid.Column="0"
Width="16"
Height="16"
IconSource="{x:Bind Item.Icon,
Mode=OneWay,
Converter={StaticResource IconSourceConverter}}"/>
<local:HighlightedTextControl
Grid.Column="1"
HorizontalAlignment="Left"
Text="{x:Bind HighlightedName, Mode=OneWay}"/>
<!-- The block for the key chord is only visible
when there's actual text set as the label. See
CommandKeyChordVisibilityConverter for details.
We're setting the accessibility view on the
border and text block to Raw because otherwise,
Narrator will read out the key chord. Problem is,
it already did that because it was the list item's
"AcceleratorKey". It's redundant. -->
<Border
Grid.Column="2"
Visibility="{x:Bind Item.KeyChordText,
Mode=OneWay,
Converter={StaticResource CommandKeyChordVisibilityConverter}}"
Style="{ThemeResource KeyChordBorderStyle}"
Padding="2,0,2,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
AutomationProperties.AccessibilityView="Raw">
<TextBlock
Style="{ThemeResource KeyChordTextBlockStyle}"
FontSize="12"
Text="{x:Bind Item.KeyChordText, Mode=OneWay}"
AutomationProperties.AccessibilityView="Raw" />
</Border>
<!-- xE70E is ChevronUp. Rotated 90 degrees, it's _ChevronRight_ -->
<FontIcon
FontFamily="Segoe MDL2 Assets"
Glyph="&#xE70E;"
HorizontalAlignment="Right"
Grid.Column="2">
<FontIcon.RenderTransform>
<RotateTransform CenterX="0.5" CenterY="0.5" Angle="90"/>
</FontIcon.RenderTransform>
</FontIcon>
</Grid>
</DataTemplate>
<DataTemplate x:Key="TabItemTemplate" x:DataType="local:FilteredCommand">
<Grid HorizontalAlignment="Stretch" ColumnSpacing="8" AutomationProperties.Name="{x:Bind Item.Name, Mode=OneWay}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="16"/>
<!-- icon / progress -->
<ColumnDefinition Width="Auto"/>
<!-- command label -->
<ColumnDefinition Width="*"/>
<!-- gutter for indicators -->
<ColumnDefinition Width="Auto"/>
<!-- Indicators -->
<ColumnDefinition Width="16"/>
<!-- gutter for scrollbar -->
</Grid.ColumnDefinitions>
<mux:ProgressRing
Grid.Column="0"
IsActive="{x:Bind Item.(local:TabPaletteItem.TabStatus).IsProgressRingActive, Mode=OneWay}"
Visibility="{x:Bind Item.(local:TabPaletteItem.TabStatus).IsProgressRingActive, Mode=OneWay}"
IsIndeterminate="{x:Bind Item.(local:TabPaletteItem.TabStatus).IsProgressRingIndeterminate, Mode=OneWay}"
Value="{x:Bind Item.(local:TabPaletteItem.TabStatus).ProgressValue, Mode=OneWay}"
MinHeight="0"
MinWidth="0"
Height="15"
Width="15"/>
<IconSourceElement
Grid.Column="0"
Width="16"
Height="16"
IconSource="{x:Bind Item.Icon,
Mode=OneWay,
Converter={StaticResource IconSourceConverter}}"/>
<local:HighlightedTextControl
Grid.Column="1"
HorizontalAlignment="Left"
Text="{x:Bind HighlightedName, Mode=OneWay}"/>
<StackPanel
Grid.Column="2"
VerticalAlignment="Center"
HorizontalAlignment="Right"
Orientation="Horizontal">
<FontIcon
FontFamily="Segoe MDL2 Assets"
Visibility="{x:Bind Item.(local:TabPaletteItem.TabStatus).BellIndicator, Mode=OneWay}"
Glyph="&#xEA8F;"
FontSize="12"
Margin="0,0,8,0"/>
<FontIcon
FontFamily="Segoe MDL2 Assets"
Visibility="{x:Bind Item.(local:TabPaletteItem.TabStatus).IsPaneZoomed, Mode=OneWay}"
Glyph="&#xE8A3;"
FontSize="12"
Margin="0,0,8,0"/>
<FontIcon x:Name="HeaderLockIcon"
FontFamily="Segoe MDL2 Assets"
Visibility="{x:Bind Item.(local:TabPaletteItem.TabStatus).IsReadOnlyActive, Mode=OneWay}"
Glyph="&#xE72E;"
FontSize="12"
Margin="0,0,8,0"/>
</StackPanel>
</Grid>
</DataTemplate>
<local:PaletteItemTemplateSelector x:Key="PaletteItemTemplateSelector"
TabItemTemplate="{StaticResource TabItemTemplate}"
GeneralItemTemplate="{StaticResource GeneralItemTemplate}"
NestedItemTemplate="{StaticResource NestedItemTemplate}"/>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Dark">
<Style x:Key="CommandPaletteBackground" TargetType="Grid">
<Setter Property="Background" Value="#333333" />
</Style>
<!-- TextBox colors !-->
<SolidColorBrush x:Key="TextControlBackground" Color="#333333"/>
<SolidColorBrush x:Key="TextBoxPlaceholderTextThemeBrush" 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="TextControlForegroundPointerOver" Color="#FFFFFF"/>
<SolidColorBrush x:Key="TextControlBorderBrushPointerOver" Color="#404040"/>
<SolidColorBrush x:Key="TextControlButtonForegroundPointerOver" Color="#FF4343"/>
<SolidColorBrush x:Key="TextControlBackgroundFocused" Color="#333333"/>
<SolidColorBrush x:Key="TextControlForegroundFocused" Color="#FFFFFF"/>
<SolidColorBrush x:Key="TextControlBorderBrushFocused" Color="#404040"/>
<SolidColorBrush x:Key="TextControlButtonForegroundPressed" Color="#FFFFFF"/>
<SolidColorBrush x:Key="TextControlButtonBackgroundPressed" Color="#FF4343"/>
<!-- KeyChordText styles -->
<Style x:Key="KeyChordBorderStyle" TargetType="Border">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="1" />
<Setter Property="Background" Value="{ThemeResource SystemAltMediumLowColor}" />
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
</Style>
<Style x:Key="KeyChordTextBlockStyle" TargetType="TextBlock">
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
</Style>
<!-- ParsedCommandLineText styles -->
<Style x:Key="ParsedCommandLineBorderStyle" TargetType="Border">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="1" />
<Setter Property="Background" Value="{ThemeResource SystemAltMediumLowColor}" />
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
</Style>
<Style x:Key="ParsedCommandLineTextBlockStyle" TargetType="TextBlock">
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
</Style>
</ResourceDictionary>
<ResourceDictionary x:Key="Light">
<Style x:Key="CommandPaletteBackground" TargetType="Grid">
<Setter Property="Background" Value="#CCCCCC" />
</Style>
<!-- TextBox colors !-->
<SolidColorBrush x:Key="TextControlBackground" Color="#CCCCCC"/>
<SolidColorBrush x:Key="TextBoxPlaceholderTextThemeBrush" Color="#636363"/>
<SolidColorBrush x:Key="TextControlBorderBrush" Color="#636363"/>
<SolidColorBrush x:Key="TextControlButtonForeground" Color="#636363"/>
<SolidColorBrush x:Key="TextControlBackgroundPointerOver" Color="#DADADA"/>
<SolidColorBrush x:Key="TextControlBorderBrushPointerOver" Color="#636363"/>
<SolidColorBrush x:Key="TextControlButtonForegroundPointerOver" Color="#FF4343"/>
<SolidColorBrush x:Key="TextControlBackgroundFocused" Color="#CCCCCC"/>
<SolidColorBrush x:Key="TextControlBorderBrushFocused" Color="#636363"/>
<SolidColorBrush x:Key="TextControlButtonForegroundPressed" Color="#FFFFFF"/>
<SolidColorBrush x:Key="TextControlButtonBackgroundPressed" Color="#FF4343"/>
<!-- KeyChordText styles -->
<Style x:Key="KeyChordBorderStyle" TargetType="Border">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="1" />
<Setter Property="Background" Value="{ThemeResource SystemAltMediumLowColor}" />
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
</Style>
<Style x:Key="KeyChordTextBlockStyle" TargetType="TextBlock">
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
</Style>
<!-- ParsedCommandLineText styles -->
<Style x:Key="ParsedCommandLineBorderStyle" TargetType="Border">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="1" />
<Setter Property="Background" Value="{ThemeResource SystemAltMediumLowColor}" />
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
</Style>
<Style x:Key="ParsedCommandLineTextBlockStyle" TargetType="TextBlock">
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
</Style>
</ResourceDictionary>
<ResourceDictionary x:Key="HighContrast">
<Style x:Key="CommandPaletteBackground" TargetType="Grid">
<Setter Property="Background" Value="{ThemeResource SystemColorWindowColor}" />
</Style>
<!-- KeyChordText styles (use XAML defaults for High Contrast theme) -->
<Style x:Key="KeyChordBorderStyle" TargetType="Border"/>
<Style x:Key="KeyChordTextBlockStyle" TargetType="TextBlock"/>
<!-- ParsedCommandLineText styles (use XAML defaults for High Contrast theme) -->
<Style x:Key="ParsedCommandLineBorderStyle" TargetType="Border"/>
<Style x:Key="ParsedCommandLineTextBlockStyle" TargetType="TextBlock"/>
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="6*" />
<ColumnDefinition Width="2*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="8*"/>
<RowDefinition Height="2*"/>
</Grid.RowDefinitions>
<!-- Setting the row/col span of this shadow backdrop is a bit of a hack. In
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
bounds of the command palette, and we don't want a semi-transparent overlay
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
to receive clicks _anywhere_ in its bounds. -->
<Grid
x:Name="_shadowBackdrop"
Background="Transparent"
Grid.Column="0"
Grid.Row="0"
Grid.ColumnSpan="3"
Grid.RowSpan="2"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
</Grid>
<Grid
x:Name="_backdrop"
Style="{ThemeResource CommandPaletteBackground}"
CornerRadius="{ThemeResource ControlCornerRadius}"
PointerPressed="_backdropPointerPressed"
Margin="8"
Grid.Column="1"
Grid.Row="0"
Windows10version1903:Shadow="{StaticResource CommandPaletteShadow}"
HorizontalAlignment="Stretch"
VerticalAlignment="Top">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBox
Grid.Row="0"
x:Name="_searchBox"
Margin="8"
Padding="18,8,8,8"
IsSpellCheckEnabled="False"
TextChanged="_filterTextChanged"
PlaceholderText="{x:Bind SearchBoxPlaceholderText, Mode=OneWay}"
Text="">
</TextBox>
<TextBlock
Grid.Row="0"
x:Name="_prefixCharacter"
Margin="16,16,0,-8"
FontSize="14"
HorizontalAlignment="Left"
Visibility="{x:Bind PrefixCharacter,
Mode=OneWay,
Converter={StaticResource ParentCommandVisibilityConverter}}"
Text="{x:Bind PrefixCharacter, Mode=OneWay}"
>
</TextBlock>
<StackPanel Orientation="Horizontal"
Padding="16, 0, 16, 4"
Grid.Row="1"
Visibility="{x:Bind ParentCommandName,
Mode=OneWay,
Converter={StaticResource ParentCommandVisibilityConverter}}">
<Button
Background="Transparent"
x:Name="_parentCommandBackButton"
x:Uid="ParentCommandBackButton"
Click="_moveBackButtonClicked"
ClickMode="Press"
VerticalAlignment="Center">
<FontIcon
FontSize="12"
FontFamily="Segoe MDL2 Assets"
Glyph="&#xE76b;">
</FontIcon>
</Button>
<TextBlock
Padding="16, 0, 16, 4"
x:Name="_parentCommandText"
FontStyle="Italic"
Grid.Row="1"
Text="{x:Bind ParentCommandName, Mode=OneWay}"
VerticalAlignment="Center">
</TextBlock>
</StackPanel>
<TextBlock
Padding="16"
x:Name="_noMatchesText"
FontStyle="Italic"
Visibility="Collapsed"
Grid.Row="1"
Text="{x:Bind NoMatchesText, Mode=OneWay}">
</TextBlock>
<Border
Grid.Row="1"
Visibility="{x:Bind ParsedCommandLineText, Mode=OneWay, Converter={StaticResource ParsedCommandLineTextVisibilityConverter}}"
Style="{ThemeResource ParsedCommandLineBorderStyle}"
Padding="16"
HorizontalAlignment="Stretch"
VerticalAlignment="Center">
<ScrollViewer MaxHeight="200" VerticalScrollBarVisibility="Auto">
<TextBlock
FontStyle="Italic"
TextWrapping="Wrap"
Text="{x:Bind ParsedCommandLineText, Mode=OneWay}"/>
</ScrollViewer>
</Border>
<ListView
Grid.Row="2"
x:Name="_filteredActionsView"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
SelectionMode="Single"
CanReorderItems="False"
AllowDrop="False"
IsItemClickEnabled="True"
ItemClick="_listItemClicked"
ChoosingItemContainer="_choosingItemContainer"
ContainerContentChanging="_containerContentChanging"
ItemsSource="{x:Bind FilteredActions}">
</ListView>
</Grid>
</Grid>
</UserControl>
<!--
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.CommandPalette"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:SettingsModel="using:Microsoft.Terminal.Settings.Model"
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:local="using:TerminalApp"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:model="using:Microsoft.Terminal.Settings.Model"
xmlns:mux="using:Microsoft.UI.Xaml.Controls"
AllowFocusOnInteraction="True"
AutomationProperties.Name="{x:Bind ControlName, Mode=OneWay}"
IsTabStop="True"
LostFocus="_lostFocusHandler"
PointerPressed="_rootPointerPressed"
PreviewKeyDown="_previewKeyDownHandler"
PreviewKeyUp="_keyUpHandler"
TabNavigation="Cycle"
mc:Ignorable="d">
<UserControl.Resources>
<ResourceDictionary>
<!--
ThemeShadow is only on 18362. This "Windows10version1903" bit
adds it conditionally
-->
<Windows10version1903:ThemeShadow x:Name="CommandPaletteShadow" />
<!-- This creates an instance of our CommandKeyChordVisibilityConverter we can reference below -->
<local:EmptyStringVisibilityConverter x:Key="CommandKeyChordVisibilityConverter" />
<local:EmptyStringVisibilityConverter x:Key="ParsedCommandLineTextVisibilityConverter" />
<local:EmptyStringVisibilityConverter x:Key="ParentCommandVisibilityConverter" />
<model:IconPathConverter x:Key="IconSourceConverter" />
<DataTemplate x:Key="ListItemTemplate"
x:DataType="local:FilteredCommand">
<ListViewItem HorizontalContentAlignment="Stretch"
AutomationProperties.AcceleratorKey="{x:Bind Item.KeyChordText, Mode=OneWay}"
AutomationProperties.Name="{x:Bind Item.Name, Mode=OneWay}" />
</DataTemplate>
<DataTemplate x:Key="GeneralItemTemplate"
x:DataType="local:FilteredCommand">
<Grid HorizontalAlignment="Stretch"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="16" />
<!-- icon -->
<ColumnDefinition Width="Auto" />
<!-- command label -->
<ColumnDefinition Width="*" />
<!-- key chord -->
<ColumnDefinition Width="16" />
<!-- gutter for scrollbar -->
</Grid.ColumnDefinitions>
<IconSourceElement Grid.Column="0"
Width="16"
Height="16"
IconSource="{x:Bind Item.Icon, Mode=OneWay, Converter={StaticResource IconSourceConverter}}" />
<local:HighlightedTextControl Grid.Column="1"
HorizontalAlignment="Left"
Text="{x:Bind HighlightedName, Mode=OneWay}" />
<!--
The block for the key chord is only visible
when there's actual text set as the label. See
CommandKeyChordVisibilityConverter for details.
We're setting the accessibility view on the
border and text block to Raw because otherwise,
Narrator will read out the key chord. Problem is,
it already did that because it was the list item's
"AcceleratorKey". It's redundant.
-->
<Border Grid.Column="2"
Padding="2,0,2,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
AutomationProperties.AccessibilityView="Raw"
Style="{ThemeResource KeyChordBorderStyle}"
Visibility="{x:Bind Item.KeyChordText, Mode=OneWay, Converter={StaticResource CommandKeyChordVisibilityConverter}}">
<TextBlock AutomationProperties.AccessibilityView="Raw"
FontSize="12"
Style="{ThemeResource KeyChordTextBlockStyle}"
Text="{x:Bind Item.KeyChordText, Mode=OneWay}" />
</Border>
</Grid>
</DataTemplate>
<DataTemplate x:Key="NestedItemTemplate"
x:DataType="local:FilteredCommand">
<Grid HorizontalAlignment="Stretch"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="16" />
<!-- icon -->
<ColumnDefinition Width="Auto" />
<!-- command label -->
<ColumnDefinition Width="*" />
<!-- key chord -->
<ColumnDefinition Width="16" />
<!-- gutter for scrollbar -->
</Grid.ColumnDefinitions>
<IconSourceElement Grid.Column="0"
Width="16"
Height="16"
IconSource="{x:Bind Item.Icon, Mode=OneWay, Converter={StaticResource IconSourceConverter}}" />
<local:HighlightedTextControl Grid.Column="1"
HorizontalAlignment="Left"
Text="{x:Bind HighlightedName, Mode=OneWay}" />
<!--
The block for the key chord is only visible
when there's actual text set as the label. See
CommandKeyChordVisibilityConverter for details.
We're setting the accessibility view on the
border and text block to Raw because otherwise,
Narrator will read out the key chord. Problem is,
it already did that because it was the list item's
"AcceleratorKey". It's redundant.
-->
<Border Grid.Column="2"
Padding="2,0,2,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
AutomationProperties.AccessibilityView="Raw"
Style="{ThemeResource KeyChordBorderStyle}"
Visibility="{x:Bind Item.KeyChordText, Mode=OneWay, Converter={StaticResource CommandKeyChordVisibilityConverter}}">
<TextBlock AutomationProperties.AccessibilityView="Raw"
FontSize="12"
Style="{ThemeResource KeyChordTextBlockStyle}"
Text="{x:Bind Item.KeyChordText, Mode=OneWay}" />
</Border>
<!-- xE70E is ChevronUp. Rotated 90 degrees, it's _ChevronRight_ -->
<FontIcon Grid.Column="2"
HorizontalAlignment="Right"
FontFamily="Segoe MDL2 Assets"
Glyph="&#xE70E;">
<FontIcon.RenderTransform>
<RotateTransform Angle="90" CenterX="0.5" CenterY="0.5" />
</FontIcon.RenderTransform>
</FontIcon>
</Grid>
</DataTemplate>
<DataTemplate x:Key="TabItemTemplate"
x:DataType="local:FilteredCommand">
<Grid HorizontalAlignment="Stretch"
AutomationProperties.Name="{x:Bind Item.Name, Mode=OneWay}"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="16" />
<!-- icon / progress -->
<ColumnDefinition Width="Auto" />
<!-- command label -->
<ColumnDefinition Width="*" />
<!-- gutter for indicators -->
<ColumnDefinition Width="Auto" />
<!-- Indicators -->
<ColumnDefinition Width="16" />
<!-- gutter for scrollbar -->
</Grid.ColumnDefinitions>
<mux:ProgressRing Grid.Column="0"
Width="15"
Height="15"
MinWidth="0"
MinHeight="0"
IsActive="{x:Bind Item.(local:TabPaletteItem.TabStatus).IsProgressRingActive, Mode=OneWay}"
IsIndeterminate="{x:Bind Item.(local:TabPaletteItem.TabStatus).IsProgressRingIndeterminate, Mode=OneWay}"
Visibility="{x:Bind Item.(local:TabPaletteItem.TabStatus).IsProgressRingActive, Mode=OneWay}"
Value="{x:Bind Item.(local:TabPaletteItem.TabStatus).ProgressValue, Mode=OneWay}" />
<IconSourceElement Grid.Column="0"
Width="16"
Height="16"
IconSource="{x:Bind Item.Icon, Mode=OneWay, Converter={StaticResource IconSourceConverter}}" />
<local:HighlightedTextControl Grid.Column="1"
HorizontalAlignment="Left"
Text="{x:Bind HighlightedName, Mode=OneWay}" />
<StackPanel Grid.Column="2"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Orientation="Horizontal">
<FontIcon Margin="0,0,8,0"
FontFamily="Segoe MDL2 Assets"
FontSize="12"
Glyph="&#xEA8F;"
Visibility="{x:Bind Item.(local:TabPaletteItem.TabStatus).BellIndicator, Mode=OneWay}" />
<FontIcon Margin="0,0,8,0"
FontFamily="Segoe MDL2 Assets"
FontSize="12"
Glyph="&#xE8A3;"
Visibility="{x:Bind Item.(local:TabPaletteItem.TabStatus).IsPaneZoomed, Mode=OneWay}" />
<FontIcon x:Name="HeaderLockIcon"
Margin="0,0,8,0"
FontFamily="Segoe MDL2 Assets"
FontSize="12"
Glyph="&#xE72E;"
Visibility="{x:Bind Item.(local:TabPaletteItem.TabStatus).IsReadOnlyActive, Mode=OneWay}" />
</StackPanel>
</Grid>
</DataTemplate>
<local:PaletteItemTemplateSelector x:Key="PaletteItemTemplateSelector"
GeneralItemTemplate="{StaticResource GeneralItemTemplate}"
NestedItemTemplate="{StaticResource NestedItemTemplate}"
TabItemTemplate="{StaticResource TabItemTemplate}" />
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Dark">
<Style x:Key="CommandPaletteBackground"
TargetType="Grid">
<Setter Property="Background" Value="#333333" />
</Style>
<!-- TextBox colors ! -->
<SolidColorBrush x:Key="TextControlBackground"
Color="#333333" />
<SolidColorBrush x:Key="TextBoxPlaceholderTextThemeBrush"
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="TextControlForegroundPointerOver"
Color="#FFFFFF" />
<SolidColorBrush x:Key="TextControlBorderBrushPointerOver"
Color="#404040" />
<SolidColorBrush x:Key="TextControlButtonForegroundPointerOver"
Color="#FF4343" />
<SolidColorBrush x:Key="TextControlBackgroundFocused"
Color="#333333" />
<SolidColorBrush x:Key="TextControlForegroundFocused"
Color="#FFFFFF" />
<SolidColorBrush x:Key="TextControlBorderBrushFocused"
Color="#404040" />
<SolidColorBrush x:Key="TextControlButtonForegroundPressed"
Color="#FFFFFF" />
<SolidColorBrush x:Key="TextControlButtonBackgroundPressed"
Color="#FF4343" />
<!-- KeyChordText styles -->
<Style x:Key="KeyChordBorderStyle"
TargetType="Border">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="1" />
<Setter Property="Background" Value="{ThemeResource SystemAltMediumLowColor}" />
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
</Style>
<Style x:Key="KeyChordTextBlockStyle"
TargetType="TextBlock">
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
</Style>
<!-- ParsedCommandLineText styles -->
<Style x:Key="ParsedCommandLineBorderStyle"
TargetType="Border">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="1" />
<Setter Property="Background" Value="{ThemeResource SystemAltMediumLowColor}" />
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
</Style>
<Style x:Key="ParsedCommandLineTextBlockStyle"
TargetType="TextBlock">
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
</Style>
</ResourceDictionary>
<ResourceDictionary x:Key="Light">
<Style x:Key="CommandPaletteBackground"
TargetType="Grid">
<Setter Property="Background" Value="#CCCCCC" />
</Style>
<!-- TextBox colors ! -->
<SolidColorBrush x:Key="TextControlBackground"
Color="#CCCCCC" />
<SolidColorBrush x:Key="TextBoxPlaceholderTextThemeBrush"
Color="#636363" />
<SolidColorBrush x:Key="TextControlBorderBrush"
Color="#636363" />
<SolidColorBrush x:Key="TextControlButtonForeground"
Color="#636363" />
<SolidColorBrush x:Key="TextControlBackgroundPointerOver"
Color="#DADADA" />
<SolidColorBrush x:Key="TextControlBorderBrushPointerOver"
Color="#636363" />
<SolidColorBrush x:Key="TextControlButtonForegroundPointerOver"
Color="#FF4343" />
<SolidColorBrush x:Key="TextControlBackgroundFocused"
Color="#CCCCCC" />
<SolidColorBrush x:Key="TextControlBorderBrushFocused"
Color="#636363" />
<SolidColorBrush x:Key="TextControlButtonForegroundPressed"
Color="#FFFFFF" />
<SolidColorBrush x:Key="TextControlButtonBackgroundPressed"
Color="#FF4343" />
<!-- KeyChordText styles -->
<Style x:Key="KeyChordBorderStyle"
TargetType="Border">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="1" />
<Setter Property="Background" Value="{ThemeResource SystemAltMediumLowColor}" />
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
</Style>
<Style x:Key="KeyChordTextBlockStyle"
TargetType="TextBlock">
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
</Style>
<!-- ParsedCommandLineText styles -->
<Style x:Key="ParsedCommandLineBorderStyle"
TargetType="Border">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="1" />
<Setter Property="Background" Value="{ThemeResource SystemAltMediumLowColor}" />
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
</Style>
<Style x:Key="ParsedCommandLineTextBlockStyle"
TargetType="TextBlock">
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
</Style>
</ResourceDictionary>
<ResourceDictionary x:Key="HighContrast">
<Style x:Key="CommandPaletteBackground"
TargetType="Grid">
<Setter Property="Background" Value="{ThemeResource SystemColorWindowColor}" />
</Style>
<!-- KeyChordText styles (use XAML defaults for High Contrast theme) -->
<Style x:Key="KeyChordBorderStyle"
TargetType="Border" />
<Style x:Key="KeyChordTextBlockStyle"
TargetType="TextBlock" />
<!-- ParsedCommandLineText styles (use XAML defaults for High Contrast theme) -->
<Style x:Key="ParsedCommandLineBorderStyle"
TargetType="Border" />
<Style x:Key="ParsedCommandLineTextBlockStyle"
TargetType="TextBlock" />
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="6*" />
<ColumnDefinition Width="2*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="8*" />
<RowDefinition Height="2*" />
</Grid.RowDefinitions>
<!--
Setting the row/col span of this shadow backdrop is a bit of a hack. In
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
bounds of the command palette, and we don't want a semi-transparent overlay
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
to receive clicks _anywhere_ in its bounds.
-->
<Grid x:Name="_shadowBackdrop"
Grid.Row="0"
Grid.RowSpan="2"
Grid.Column="0"
Grid.ColumnSpan="3"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="Transparent" />
<Grid x:Name="_backdrop"
Grid.Row="0"
Grid.Column="1"
Margin="8"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
Windows10version1903:Shadow="{StaticResource CommandPaletteShadow}"
CornerRadius="{ThemeResource ControlCornerRadius}"
PointerPressed="_backdropPointerPressed"
Style="{ThemeResource CommandPaletteBackground}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBox x:Name="_searchBox"
Grid.Row="0"
Margin="8"
Padding="18,8,8,8"
IsSpellCheckEnabled="False"
PlaceholderText="{x:Bind SearchBoxPlaceholderText, Mode=OneWay}"
Text=""
TextChanged="_filterTextChanged" />
<TextBlock x:Name="_prefixCharacter"
Grid.Row="0"
Margin="16,16,0,-8"
HorizontalAlignment="Left"
FontSize="14"
Text="{x:Bind PrefixCharacter, Mode=OneWay}"
Visibility="{x:Bind PrefixCharacter, Mode=OneWay, Converter={StaticResource ParentCommandVisibilityConverter}}" />
<StackPanel Grid.Row="1"
Padding="16,0,16,4"
Orientation="Horizontal"
Visibility="{x:Bind ParentCommandName, Mode=OneWay, Converter={StaticResource ParentCommandVisibilityConverter}}">
<Button x:Name="_parentCommandBackButton"
x:Uid="ParentCommandBackButton"
VerticalAlignment="Center"
Background="Transparent"
Click="_moveBackButtonClicked"
ClickMode="Press">
<FontIcon FontFamily="Segoe MDL2 Assets"
FontSize="12"
Glyph="&#xE76b;" />
</Button>
<TextBlock x:Name="_parentCommandText"
Grid.Row="1"
Padding="16,0,16,4"
VerticalAlignment="Center"
FontStyle="Italic"
Text="{x:Bind ParentCommandName, Mode=OneWay}" />
</StackPanel>
<TextBlock x:Name="_noMatchesText"
Grid.Row="1"
Padding="16"
FontStyle="Italic"
Text="{x:Bind NoMatchesText, Mode=OneWay}"
Visibility="Collapsed" />
<Border Grid.Row="1"
Padding="16"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
Style="{ThemeResource ParsedCommandLineBorderStyle}"
Visibility="{x:Bind ParsedCommandLineText, Mode=OneWay, Converter={StaticResource ParsedCommandLineTextVisibilityConverter}}">
<ScrollViewer MaxHeight="200"
VerticalScrollBarVisibility="Auto">
<TextBlock FontStyle="Italic"
Text="{x:Bind ParsedCommandLineText, Mode=OneWay}"
TextWrapping="Wrap" />
</ScrollViewer>
</Border>
<ListView x:Name="_filteredActionsView"
Grid.Row="2"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
AllowDrop="False"
CanReorderItems="False"
ChoosingItemContainer="_choosingItemContainer"
ContainerContentChanging="_containerContentChanging"
IsItemClickEnabled="True"
ItemClick="_listItemClicked"
ItemsSource="{x:Bind FilteredActions}"
SelectionMode="Single" />
</Grid>
</Grid>
</UserControl>

View File

@ -1,13 +1,11 @@
<UserControl
x:Class="TerminalApp.HighlightedTextControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:TerminalApp"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="Transparent">
<UserControl x:Class="TerminalApp.HighlightedTextControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:TerminalApp"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Background="Transparent"
mc:Ignorable="d">
<TextBlock
x:Name="_textView"/>
<TextBlock x:Name="_textView" />
</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. -->
<StackPanel
x:Class="TerminalApp.MinMaxCloseControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="Transparent"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Orientation="Horizontal"
d:DesignHeight="36"
d:DesignWidth="400">
<!--
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
the MIT License. See LICENSE in the project root for license information.
-->
<StackPanel x:Class="TerminalApp.MinMaxCloseControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
HorizontalAlignment="Left"
VerticalAlignment="Top"
d:DesignHeight="36"
d:DesignWidth="400"
Background="Transparent"
Orientation="Horizontal"
mc:Ignorable="d">
<StackPanel.Resources>
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Light">
<x:Double x:Key="CaptionButtonStrokeWidth">1.0</x:Double>
<StaticResource x:Key="CaptionButtonBackgroundPointerOver" ResourceKey="SystemControlBackgroundBaseLowBrush"/>
<StaticResource x:Key="CaptionButtonBackgroundPressed" ResourceKey="SystemControlBackgroundBaseMediumLowBrush"/>
<StaticResource x:Key="CaptionButtonStroke" ResourceKey="SystemControlForegroundBaseHighBrush"/>
<StaticResource x:Key="CaptionButtonStrokeColor" ResourceKey="SystemBaseHighColor"/>
<StaticResource x:Key="CaptionButtonStrokePointerOver" ResourceKey="SystemControlForegroundBaseHighBrush"/>
<StaticResource x:Key="CaptionButtonStrokePressed" ResourceKey="SystemControlForegroundBaseHighBrush"/>
<SolidColorBrush x:Key="CaptionButtonBackground" Color="Transparent" />
<StaticResource x:Key="CaptionButtonBackgroundPointerOver"
ResourceKey="SystemControlBackgroundBaseLowBrush" />
<StaticResource x:Key="CaptionButtonBackgroundPressed"
ResourceKey="SystemControlBackgroundBaseMediumLowBrush" />
<StaticResource x:Key="CaptionButtonStroke"
ResourceKey="SystemControlForegroundBaseHighBrush" />
<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>
<SolidColorBrush x:Key="CloseButtonBackgroundPointerOver" Color="#e81123"/>
<SolidColorBrush x:Key="CloseButtonStrokePointerOver" Color="White"/>
<SolidColorBrush x:Key="CloseButtonBackgroundPressed" Color="#f1707a"/>
<SolidColorBrush x:Key="CloseButtonStrokePressed" Color="Black"/>
<SolidColorBrush x:Key="CloseButtonBackgroundPointerOver"
Color="#e81123" />
<SolidColorBrush x:Key="CloseButtonStrokePointerOver"
Color="White" />
<SolidColorBrush x:Key="CloseButtonBackgroundPressed"
Color="#f1707a" />
<SolidColorBrush x:Key="CloseButtonStrokePressed"
Color="Black" />
</ResourceDictionary>
<ResourceDictionary x:Key="Dark">
<x:Double x:Key="CaptionButtonStrokeWidth">1.0</x:Double>
<StaticResource x:Key="CaptionButtonBackgroundPointerOver" ResourceKey="SystemControlBackgroundBaseLowBrush"/>
<StaticResource x:Key="CaptionButtonBackgroundPressed" ResourceKey="SystemControlBackgroundBaseMediumLowBrush"/>
<StaticResource x:Key="CaptionButtonStroke" ResourceKey="SystemControlForegroundBaseHighBrush"/>
<StaticResource x:Key="CaptionButtonStrokeColor" ResourceKey="SystemBaseHighColor"/>
<StaticResource x:Key="CaptionButtonStrokePointerOver" ResourceKey="SystemControlForegroundBaseHighBrush"/>
<StaticResource x:Key="CaptionButtonStrokePressed" ResourceKey="SystemControlForegroundBaseHighBrush"/>
<SolidColorBrush x:Key="CaptionButtonBackground" Color="Transparent" />
<StaticResource x:Key="CaptionButtonBackgroundPointerOver"
ResourceKey="SystemControlBackgroundBaseLowBrush" />
<StaticResource x:Key="CaptionButtonBackgroundPressed"
ResourceKey="SystemControlBackgroundBaseMediumLowBrush" />
<StaticResource x:Key="CaptionButtonStroke"
ResourceKey="SystemControlForegroundBaseHighBrush" />
<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>
<SolidColorBrush x:Key="CloseButtonBackgroundPointerOver" Color="#e81123"/>
<SolidColorBrush x:Key="CloseButtonStrokePointerOver" Color="White"/>
<SolidColorBrush x:Key="CloseButtonBackgroundPressed" Color="#f1707a"/>
<SolidColorBrush x:Key="CloseButtonStrokePressed" Color="Black"/>
<SolidColorBrush x:Key="CloseButtonBackgroundPointerOver"
Color="#e81123" />
<SolidColorBrush x:Key="CloseButtonStrokePointerOver"
Color="White" />
<SolidColorBrush x:Key="CloseButtonBackgroundPressed"
Color="#f1707a" />
<SolidColorBrush x:Key="CloseButtonStrokePressed"
Color="Black" />
</ResourceDictionary>
<ResourceDictionary x:Key="HighContrast">
<x:Double x:Key="CaptionButtonStrokeWidth">3.0</x:Double>
<SolidColorBrush x:Key="CaptionButtonBackground" Color="{ThemeResource SystemColorButtonFaceColor}"/>
<StaticResource x:Key="CaptionButtonBackgroundColor" ResourceKey="SystemColorButtonFaceColor"/>
<SolidColorBrush x:Key="CaptionButtonBackgroundPointerOver" Color="{ThemeResource SystemColorHighlightColor}"/>
<SolidColorBrush x:Key="CaptionButtonBackgroundPressed" Color="{ThemeResource SystemColorHighlightColor}"/>
<SolidColorBrush x:Key="CaptionButtonStroke" Color="{ThemeResource SystemColorButtonTextColor}"/>
<StaticResource x:Key="CaptionButtonStrokeColor" 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}"/>
<SolidColorBrush x:Key="CaptionButtonBackground"
Color="{ThemeResource SystemColorButtonFaceColor}" />
<StaticResource x:Key="CaptionButtonBackgroundColor"
ResourceKey="SystemColorButtonFaceColor" />
<SolidColorBrush x:Key="CaptionButtonBackgroundPointerOver"
Color="{ThemeResource SystemColorHighlightColor}" />
<SolidColorBrush x:Key="CaptionButtonBackgroundPressed"
Color="{ThemeResource SystemColorHighlightColor}" />
<SolidColorBrush x:Key="CaptionButtonStroke"
Color="{ThemeResource SystemColorButtonTextColor}" />
<StaticResource x:Key="CaptionButtonStrokeColor"
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.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
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
tabs will be flush with the top of the window. See GH#2541 for
details.-->
<!--
"CaptionButtonHeightWindowed" and
"CaptionButtonHeightMaximized" define the size we should use
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
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="CaptionButtonHeightMaximized">32.0</x:Double>
<Style x:Key="CaptionButton" TargetType="Button">
<Setter Property="BorderThickness" Value="0"/>
<Style x:Key="CaptionButton"
TargetType="Button">
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Background" Value="{ThemeResource CaptionButtonBackground}" />
<Setter Property="IsTabStop" Value="False" />
<Setter Property="Template">
@ -88,21 +131,38 @@ the MIT License. See LICENSE in the project root for license information. -->
<ControlTemplate TargetType="Button">
<Border x:Name="ButtonBaseElement"
Background="{TemplateBinding Background}"
BackgroundSizing="{TemplateBinding BackgroundSizing}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
Padding="{TemplateBinding Padding}"
AutomationProperties.AccessibilityView="Raw">
Padding="{TemplateBinding Padding}"
AutomationProperties.AccessibilityView="Raw"
Background="{TemplateBinding Background}"
BackgroundSizing="{TemplateBinding BackgroundSizing}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
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>
<VisualStateGroup x:Name="CommonStates">
<VisualStateGroup.Transitions>
<VisualTransition From="PointerOver" To="Normal">
<VisualTransition From="PointerOver"
To="Normal">
<Storyboard>
<ColorAnimation Storyboard.TargetName="ButtonBaseElement" 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"/>
<ColorAnimation Storyboard.TargetName="ButtonBaseElement"
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>
</VisualTransition>
</VisualStateGroup.Transitions>
@ -142,18 +202,6 @@ the MIT License. See LICENSE in the project root for license information. -->
</VisualStateGroup>
</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>
</ControlTemplate>
@ -164,24 +212,28 @@ the MIT License. See LICENSE in the project root for license information. -->
</ResourceDictionary>
</StackPanel.Resources>
<Button Height="{StaticResource CaptionButtonHeightWindowed}" MinWidth="46.0" Width="46.0"
x:Name="MinimizeButton"
<Button x:Name="MinimizeButton"
x:Uid="WindowMinimizeButton"
Style="{StaticResource CaptionButton}"
Width="46.0"
Height="{StaticResource CaptionButtonHeightWindowed}"
MinWidth="46.0"
AutomationProperties.AccessibilityView="Raw"
Click="_MinimizeClick"
AutomationProperties.AccessibilityView="Raw">
Style="{StaticResource CaptionButton}">
<Button.Resources>
<ResourceDictionary>
<x:String x:Key="CaptionButtonPath">M 0 0 H 10</x:String>
</ResourceDictionary>
</Button.Resources>
</Button>
<Button Height="{StaticResource CaptionButtonHeightWindowed}" MinWidth="46.0" Width="46.0"
x:Name="MaximizeButton"
<Button x:Name="MaximizeButton"
x:Uid="WindowMaximizeButton"
Style="{StaticResource CaptionButton}"
Width="46.0"
Height="{StaticResource CaptionButtonHeightWindowed}"
MinWidth="46.0"
AutomationProperties.AccessibilityView="Raw"
Click="_MaximizeClick"
AutomationProperties.AccessibilityView="Raw">
Style="{StaticResource CaptionButton}">
<Button.Resources>
<ResourceDictionary>
<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>
<ToolTip>
<TextBlock>
<Run x:Name="MaximizeToolTip"/>
<Run x:Name="MaximizeToolTip" />
</TextBlock>
</ToolTip>
</ToolTipService.ToolTip>
</Button>
<Button Height="{StaticResource CaptionButtonHeightWindowed}" MinWidth="46.0" Width="46.0"
x:Name="CloseButton"
<Button x:Name="CloseButton"
x:Uid="WindowCloseButton"
Style="{StaticResource CaptionButton}"
Width="46.0"
Height="{StaticResource CaptionButtonHeightWindowed}"
MinWidth="46.0"
AutomationProperties.AccessibilityView="Raw"
Click="_CloseClick"
AutomationProperties.AccessibilityView="Raw">
Style="{StaticResource CaptionButton}">
<Button.Resources>
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Light">
<StaticResource x:Key="CaptionButtonBackgroundPointerOver" ResourceKey="CloseButtonBackgroundPointerOver"/>
<StaticResource x:Key="CaptionButtonBackgroundPressed" ResourceKey="CloseButtonBackgroundPressed"/>
<StaticResource x:Key="CaptionButtonStrokePointerOver" ResourceKey="CloseButtonStrokePointerOver"/>
<StaticResource x:Key="CaptionButtonStrokePressed" ResourceKey="CloseButtonStrokePressed"/>
<StaticResource x:Key="CaptionButtonBackgroundPointerOver"
ResourceKey="CloseButtonBackgroundPointerOver" />
<StaticResource x:Key="CaptionButtonBackgroundPressed"
ResourceKey="CloseButtonBackgroundPressed" />
<StaticResource x:Key="CaptionButtonStrokePointerOver"
ResourceKey="CloseButtonStrokePointerOver" />
<StaticResource x:Key="CaptionButtonStrokePressed"
ResourceKey="CloseButtonStrokePressed" />
</ResourceDictionary>
<ResourceDictionary x:Key="Dark">
<StaticResource x:Key="CaptionButtonBackgroundPointerOver" ResourceKey="CloseButtonBackgroundPointerOver"/>
<StaticResource x:Key="CaptionButtonBackgroundPressed" ResourceKey="CloseButtonBackgroundPressed"/>
<StaticResource x:Key="CaptionButtonStrokePointerOver" ResourceKey="CloseButtonStrokePointerOver"/>
<StaticResource x:Key="CaptionButtonStrokePressed" ResourceKey="CloseButtonStrokePressed"/>
<StaticResource x:Key="CaptionButtonBackgroundPointerOver"
ResourceKey="CloseButtonBackgroundPointerOver" />
<StaticResource x:Key="CaptionButtonBackgroundPressed"
ResourceKey="CloseButtonBackgroundPressed" />
<StaticResource x:Key="CaptionButtonStrokePointerOver"
ResourceKey="CloseButtonStrokePointerOver" />
<StaticResource x:Key="CaptionButtonStrokePressed"
ResourceKey="CloseButtonStrokePressed" />
</ResourceDictionary>
<ResourceDictionary x:Key="HighContrast">
<StaticResource x:Key="CaptionButtonBackgroundPointerOver" ResourceKey="CloseButtonBackgroundPointerOver"/>
<StaticResource x:Key="CaptionButtonBackgroundPressed" ResourceKey="CloseButtonBackgroundPressed"/>
<StaticResource x:Key="CaptionButtonStrokePointerOver" ResourceKey="CloseButtonStrokePointerOver"/>
<StaticResource x:Key="CaptionButtonStrokePressed" ResourceKey="CloseButtonStrokePressed"/>
<StaticResource x:Key="CaptionButtonBackgroundPointerOver"
ResourceKey="CloseButtonBackgroundPointerOver" />
<StaticResource x:Key="CaptionButtonBackgroundPressed"
ResourceKey="CloseButtonBackgroundPressed" />
<StaticResource x:Key="CaptionButtonStrokePointerOver"
ResourceKey="CloseButtonStrokePointerOver" />
<StaticResource x:Key="CaptionButtonStrokePressed"
ResourceKey="CloseButtonStrokePressed" />
</ResourceDictionary>
</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. -->
<UserControl
x:Class="TerminalApp.TabHeaderControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:TerminalApp"
xmlns:mux="using:Microsoft.UI.Xaml.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
MinHeight="16">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Light">
<Thickness x:Key="TextControlBorderThemeThicknessFocused">0,0,0,1</Thickness>
</ResourceDictionary>
<ResourceDictionary x:Key="Dark">
<Thickness x:Key="TextControlBorderThemeThicknessFocused">0,0,0,1</Thickness>
</ResourceDictionary>
<ResourceDictionary x:Key="HighContrast">
<Thickness x:Key="TextControlBorderThemeThicknessFocused">0,0,0,1</Thickness>
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<StackPanel x:Name="HeaderStackPanel"
Orientation="Horizontal">
<mux:ProgressRing x:Name="HeaderProgressRing"
IsActive="{x:Bind TabStatus.IsProgressRingActive, Mode=OneWay}"
Visibility="{x:Bind TabStatus.IsProgressRingActive, Mode=OneWay}"
IsIndeterminate="{x:Bind TabStatus.IsProgressRingIndeterminate, Mode=OneWay}"
Value="{x:Bind TabStatus.ProgressValue, Mode=OneWay}"
MinHeight="0"
MinWidth="0"
Height="15"
Width="15"
Margin="-7.5,0,8,0"/>
<!--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-->
<!--
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"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:TerminalApp"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mux="using:Microsoft.UI.Xaml.Controls"
MinHeight="16"
mc:Ignorable="d">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Light">
<Thickness x:Key="TextControlBorderThemeThicknessFocused">0,0,0,1</Thickness>
</ResourceDictionary>
<ResourceDictionary x:Key="Dark">
<Thickness x:Key="TextControlBorderThemeThicknessFocused">0,0,0,1</Thickness>
</ResourceDictionary>
<ResourceDictionary x:Key="HighContrast">
<Thickness x:Key="TextControlBorderThemeThicknessFocused">0,0,0,1</Thickness>
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<StackPanel x:Name="HeaderStackPanel"
Orientation="Horizontal">
<mux:ProgressRing x:Name="HeaderProgressRing"
Width="15"
Height="15"
MinWidth="0"
MinHeight="0"
Margin="-7.5,0,8,0"
IsActive="{x:Bind TabStatus.IsProgressRingActive, Mode=OneWay}"
IsIndeterminate="{x:Bind TabStatus.IsProgressRingIndeterminate, Mode=OneWay}"
Visibility="{x:Bind TabStatus.IsProgressRingActive, Mode=OneWay}"
Value="{x:Bind TabStatus.ProgressValue, Mode=OneWay}" />
<!--
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"
Margin="0,0,8,0"
FontFamily="Segoe MDL2 Assets"
Visibility="{x:Bind TabStatus.BellIndicator, Mode=OneWay}"
Glyph="&#xEA8F;"
FontSize="12"
Margin="0,0,8,0"/>
<FontIcon x:Name="HeaderZoomIcon"
FontFamily="Segoe MDL2 Assets"
Visibility="{x:Bind TabStatus.IsPaneZoomed, Mode=OneWay}"
Glyph="&#xE8A3;"
FontSize="12"
Margin="0,0,8,0"/>
<FontIcon x:Name="HeaderLockIcon"
FontFamily="Segoe MDL2 Assets"
Visibility="{x:Bind TabStatus.IsReadOnlyActive, Mode=OneWay}"
Glyph="&#xE72E;"
FontSize="12"
Margin="0,0,8,0"/>
<TextBlock x:Name="HeaderTextBlock"
Visibility="Visible"
Text="{x:Bind Title, Mode=OneWay}"/>
<TextBox x:Name="HeaderRenamerTextBox"
Visibility="Collapsed"
MinHeight="0"
Padding="4,0,4,0"
MaxLength="1024"
LostFocus="RenameBoxLostFocusHandler"
Height="16"
FontSize="12"
IsSpellCheckEnabled="False"
MaxWidth="{x:Bind RenamerMaxWidth, Mode=OneWay}"/>
</StackPanel>
</UserControl>
Glyph="&#xEA8F;"
Visibility="{x:Bind TabStatus.BellIndicator, Mode=OneWay}" />
<FontIcon x:Name="HeaderZoomIcon"
Margin="0,0,8,0"
FontFamily="Segoe MDL2 Assets"
FontSize="12"
Glyph="&#xE8A3;"
Visibility="{x:Bind TabStatus.IsPaneZoomed, Mode=OneWay}" />
<FontIcon x:Name="HeaderLockIcon"
Margin="0,0,8,0"
FontFamily="Segoe MDL2 Assets"
FontSize="12"
Glyph="&#xE72E;"
Visibility="{x:Bind TabStatus.IsReadOnlyActive, Mode=OneWay}" />
<TextBlock x:Name="HeaderTextBlock"
Text="{x:Bind Title, Mode=OneWay}"
Visibility="Visible" />
<TextBox x:Name="HeaderRenamerTextBox"
Height="16"
MinHeight="0"
MaxWidth="{x:Bind RenamerMaxWidth, Mode=OneWay}"
Padding="4,0,4,0"
FontSize="12"
IsSpellCheckEnabled="False"
LostFocus="RenameBoxLostFocusHandler"
MaxLength="1024"
Visibility="Collapsed" />
</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. -->
<ContentPresenter
x:Class="TerminalApp.TabRowControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:TerminalApp"
xmlns:mux="using:Microsoft.UI.Xaml.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<mux:TabView x:Name="TabView"
VerticalAlignment="Bottom"
HorizontalContentAlignment="Stretch"
IsAddTabButtonVisible="false"
TabWidthMode="Equal"
CanReorderTabs="True"
CanDragTabs="True"
AllowDropTabs="True">
<mux:TabView.TabStripFooter>
<mux:SplitButton
x:Name="NewTabButton"
x:Uid="NewTabSplitButton"
Click="OnNewTabButtonClick"
VerticalAlignment="Stretch"
HorizontalAlignment="Left"
Content="&#xE710;"
UseLayoutRounding="true"
FontFamily="Segoe MDL2 Assets"
FontWeight="SemiLight"
FontSize="12"
BorderThickness="0"
CornerRadius="{Binding Source={ThemeResource OverlayCornerRadius}, Converter={StaticResource TopCornerRadiusFilterConverter}}"
AutomationProperties.AccessibilityView="Control">
<!--
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
the MIT License. See LICENSE in the project root for license information.
-->
<ContentPresenter x:Class="TerminalApp.TabRowControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:TerminalApp"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mux="using:Microsoft.UI.Xaml.Controls"
mc:Ignorable="d">
<mux:TabView x:Name="TabView"
VerticalAlignment="Bottom"
HorizontalContentAlignment="Stretch"
AllowDropTabs="True"
CanDragTabs="True"
CanReorderTabs="True"
IsAddTabButtonVisible="false"
TabWidthMode="Equal">
<mux:TabView.TabStripFooter>
<mux:SplitButton x:Name="NewTabButton"
x:Uid="NewTabSplitButton"
HorizontalAlignment="Left"
VerticalAlignment="Stretch"
AutomationProperties.AccessibilityView="Control"
BorderThickness="0"
Click="OnNewTabButtonClick"
Content="&#xE710;"
CornerRadius="{Binding Source={ThemeResource OverlayCornerRadius}, Converter={StaticResource TopCornerRadiusFilterConverter}}"
FontFamily="Segoe MDL2 Assets"
FontSize="12"
FontWeight="SemiLight"
UseLayoutRounding="true">
<ToolTipService.ToolTip>
<ToolTip Placement="Mouse">
<TextBlock IsTextSelectionEnabled="False">
<Run x:Uid="NewTabRun"/> <LineBreak/>
<Run x:Uid="NewTabRun" /> <LineBreak />
<Run x:Uid="NewPaneRun"
FontStyle="Italic"/> <LineBreak/>
FontStyle="Italic" /> <LineBreak />
<Run x:Uid="NewWindowRun"
FontStyle="Italic"/>
FontStyle="Italic" />
</TextBlock>
</ToolTip>
</ToolTipService.ToolTip>
<!-- U+E710 is the fancy plus icon. -->
<mux:SplitButton.Resources>
<!-- Override the SplitButton* resources to match the tab view's button's styles. -->
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Light">
<StaticResource x:Key="SplitButtonBackground" ResourceKey="TabViewButtonBackground" />
<StaticResource x:Key="SplitButtonForeground" 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 x:Key="Dark">
<StaticResource x:Key="SplitButtonBackground" ResourceKey="TabViewButtonBackground" />
<StaticResource x:Key="SplitButtonForeground" 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 x:Key="HighContrast">
<StaticResource x:Key="SplitButtonBackground" ResourceKey="TabViewButtonBackground" />
<StaticResource x:Key="SplitButtonForeground" 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>
</ToolTipService.ToolTip>
<!-- U+E710 is the fancy plus icon. -->
<mux:SplitButton.Resources>
<!-- Override the SplitButton* resources to match the tab view's button's styles. -->
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Light">
<StaticResource x:Key="SplitButtonBackground"
ResourceKey="TabViewButtonBackground" />
<StaticResource x:Key="SplitButtonForeground"
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 x:Key="Dark">
<StaticResource x:Key="SplitButtonBackground"
ResourceKey="TabViewButtonBackground" />
<StaticResource x:Key="SplitButtonForeground"
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 x:Key="HighContrast">
<StaticResource x:Key="SplitButtonBackground"
ResourceKey="TabViewButtonBackground" />
<StaticResource x:Key="SplitButtonForeground"
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. -->
<Page
x:Class="TerminalApp.TerminalPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:TerminalApp"
xmlns:mux="using:Microsoft.UI.Xaml.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid x:Name="Root" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<local:TabRowControl x:Name="TabRow" Grid.Row="0" />
<Grid x:Name="TabContent" Grid.Row="1" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />
<ContentDialog
x:Load="False"
x:Name="AboutDialog"
x:Uid="AboutDialog"
DefaultButton="Close">
<StackPanel Orientation="Vertical">
<TextBlock IsTextSelectionEnabled="True">
<Run Text="{x:Bind ApplicationDisplayName}" /> <LineBreak />
<Run x:Uid="AboutDialog_VersionLabel" />
<Run Text="{x:Bind ApplicationVersion}" />
</TextBlock>
<HyperlinkButton
x:Uid="AboutDialog_DocumentationLink"
NavigateUri="https://go.microsoft.com/fwlink/?linkid=2125416" />
<HyperlinkButton
x:Uid="AboutDialog_ReleaseNotesLink"
NavigateUri="https://go.microsoft.com/fwlink/?linkid=2125417" />
<HyperlinkButton
x:Uid="AboutDialog_PrivacyPolicyLink"
NavigateUri="https://go.microsoft.com/fwlink/?linkid=2125418" />
<HyperlinkButton
x:Uid="AboutDialog_ThirdPartyNoticesLink"
Click="_ThirdPartyNoticesOnClick" />
</StackPanel>
</ContentDialog>
<ContentDialog
x:Load="False"
x:Name="CloseAllDialog"
x:Uid="CloseAllDialog"
DefaultButton="Primary">
</ContentDialog>
<ContentDialog
x:Load="False"
x:Name="CloseReadOnlyDialog"
x:Uid="CloseReadOnlyDialog"
DefaultButton="Close">
</ContentDialog>
<ContentDialog
x:Load="False"
x:Name="MultiLinePasteDialog"
x:Uid="MultiLinePasteDialog"
DefaultButton="Primary">
<StackPanel>
<TextBlock
x:Uid="MultiLineWarningText"
TextWrapping="Wrap">
</TextBlock>
<TextBlock
x:Uid="ClipboardTextHeader"
Margin="0,16,0,0">
</TextBlock>
<ScrollViewer
Margin="0,8,0,0"
x:Name="ClipboardContentScrollViewer"
MaxHeight="100">
<TextBlock
x:Name="ClipboardText"
TextWrapping="Wrap"
FontFamily="Cascadia Mono">
</TextBlock>
</ScrollViewer>
</StackPanel>
</ContentDialog>
<ContentDialog
x:Load="False"
x:Name="LargePasteDialog"
x:Uid="LargePasteDialog"
DefaultButton="Primary">
</ContentDialog>
<ContentDialog
x:Load="False"
x:Name="ControlNoticeDialog"
x:Uid="ControlNoticeDialog"
DefaultButton="Primary">
<TextBlock IsTextSelectionEnabled="True" TextWrapping="WrapWholeWords">
<Run x:Name="NoticeMessage"/>
</TextBlock>
</ContentDialog>
<ContentDialog
x:Load="False"
x:Name="CouldNotOpenUriDialog"
x:Uid="CouldNotOpenUriDialog"
DefaultButton="Primary">
<TextBlock IsTextSelectionEnabled="True" TextWrapping="WrapWholeWords">
<Run x:Name="CouldNotOpenUriReason" /> <LineBreak />
<Run
x:Name="UnopenedUri"
FontFamily="Cascadia Mono">
</Run>
</TextBlock>
</ContentDialog>
<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>
<!--
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
the MIT License. See LICENSE in the project root for license information.
-->
<Page x:Class="TerminalApp.TerminalPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:TerminalApp"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mux="using:Microsoft.UI.Xaml.Controls"
mc:Ignorable="d">
<Grid x:Name="Root"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<local:TabRowControl x:Name="TabRow"
Grid.Row="0" />
<Grid x:Name="TabContent"
Grid.Row="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" />
<ContentDialog x:Name="AboutDialog"
x:Uid="AboutDialog"
x:Load="False"
DefaultButton="Close">
<StackPanel Orientation="Vertical">
<TextBlock IsTextSelectionEnabled="True">
<Run Text="{x:Bind ApplicationDisplayName}" /> <LineBreak />
<Run x:Uid="AboutDialog_VersionLabel" />
<Run Text="{x:Bind ApplicationVersion}" />
</TextBlock>
<HyperlinkButton x:Uid="AboutDialog_DocumentationLink"
NavigateUri="https://go.microsoft.com/fwlink/?linkid=2125416" />
<HyperlinkButton x:Uid="AboutDialog_ReleaseNotesLink"
NavigateUri="https://go.microsoft.com/fwlink/?linkid=2125417" />
<HyperlinkButton x:Uid="AboutDialog_PrivacyPolicyLink"
NavigateUri="https://go.microsoft.com/fwlink/?linkid=2125418" />
<HyperlinkButton x:Uid="AboutDialog_ThirdPartyNoticesLink"
Click="_ThirdPartyNoticesOnClick" />
</StackPanel>
</ContentDialog>
<ContentDialog x:Name="CloseAllDialog"
x:Uid="CloseAllDialog"
x:Load="False"
DefaultButton="Primary" />
<ContentDialog x:Name="CloseReadOnlyDialog"
x:Uid="CloseReadOnlyDialog"
x:Load="False"
DefaultButton="Close" />
<ContentDialog x:Name="MultiLinePasteDialog"
x:Uid="MultiLinePasteDialog"
x:Load="False"
DefaultButton="Primary">
<StackPanel>
<TextBlock x:Uid="MultiLineWarningText"
TextWrapping="Wrap" />
<TextBlock x:Uid="ClipboardTextHeader"
Margin="0,16,0,0" />
<ScrollViewer x:Name="ClipboardContentScrollViewer"
MaxHeight="100"
Margin="0,8,0,0">
<TextBlock x:Name="ClipboardText"
FontFamily="Cascadia Mono"
TextWrapping="Wrap" />
</ScrollViewer>
</StackPanel>
</ContentDialog>
<ContentDialog x:Name="LargePasteDialog"
x:Uid="LargePasteDialog"
x:Load="False"
DefaultButton="Primary" />
<ContentDialog x:Name="ControlNoticeDialog"
x:Uid="ControlNoticeDialog"
x:Load="False"
DefaultButton="Primary">
<TextBlock IsTextSelectionEnabled="True"
TextWrapping="WrapWholeWords">
<Run x:Name="NoticeMessage" />
</TextBlock>
</ContentDialog>
<ContentDialog x:Name="CouldNotOpenUriDialog"
x:Uid="CouldNotOpenUriDialog"
x:Load="False"
DefaultButton="Primary">
<TextBlock IsTextSelectionEnabled="True"
TextWrapping="WrapWholeWords">
<Run x:Name="CouldNotOpenUriReason" /> <LineBreak />
<Run x:Name="UnopenedUri"
FontFamily="Cascadia Mono" />
</TextBlock>
</ContentDialog>
<local:CommandPalette x:Name="CommandPalette"
Grid.Row="1"
VerticalAlignment="Stretch"
PreviewKeyDown="_KeyDownHandler"
Visibility="Collapsed" />
<mux:InfoBar x:Name="KeyboardWarningInfoBar"
x:Load="False"
IsClosable="True"
IsIconVisible="True"
IsOpen="False"
Message="{x:Bind KeyboardServiceDisabledText, Mode=OneWay}"
Severity="Warning" />
</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. -->
<Grid
x:Class="TerminalApp.TitlebarControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:TerminalApp"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
x:Name="Root"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
SizeChanged="Root_SizeChanged"
d:DesignHeight="36"
Background="{ThemeResource TabViewBackground}"
d:DesignWidth="400">
<!--
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
the MIT License. See LICENSE in the project root for license information.
-->
<Grid x:Class="TerminalApp.TitlebarControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:TerminalApp"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Name="Root"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
d:DesignHeight="36"
d:DesignWidth="400"
Background="{ThemeResource TabViewBackground}"
SizeChanged="Root_SizeChanged"
mc:Ignorable="d">
<!-- TODO:GH#1988
This xaml should probably be a template thing, where the background is a
resource that the app hosting this control can override. Then, it App.xaml,
we'd make sure to set the resource for our background to the appropriate
color. SystemControlForegroundAccentBrush also works nicely, to use the
accent color. (which is GH#1963)-->
<!--
TODO:GH#1988
This xaml should probably be a template thing, where the background is a
resource that the app hosting this control can override. Then, it App.xaml,
we'd make sure to set the resource for our background to the appropriate
color. SystemControlForegroundAccentBrush also works nicely, to use the
accent color. (which is GH#1963)
-->
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ContentPresenter x:Name="ContentRoot" Grid.Column="0" />
<ContentPresenter x:Name="ContentRoot"
Grid.Column="0" />
<Border
x:Name="DragBar"
Grid.Column="1"
MinWidth="45.0"
DoubleTapped="DragBar_DoubleTapped"/>
<Border x:Name="DragBar"
Grid.Column="1"
MinWidth="45.0"
DoubleTapped="DragBar_DoubleTapped" />
<local:MinMaxCloseControl
Grid.Column="2"
x:Name="MinMaxCloseControl"
HorizontalAlignment="Right" />
<local:MinMaxCloseControl x:Name="MinMaxCloseControl"
Grid.Column="2"
HorizontalAlignment="Right" />
</Grid>

View File

@ -1,149 +1,225 @@
<UserControl
x:Class="Microsoft.Terminal.Control.SearchBoxControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.Terminal.Control"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
x:Name="Root"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
d:DesignHeight="55"
d:DesignWidth="285"
TabNavigation="Cycle">
<UserControl x:Class="Microsoft.Terminal.Control.SearchBoxControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.Terminal.Control"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Name="Root"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
d:DesignHeight="55"
d:DesignWidth="285"
TabNavigation="Cycle"
mc:Ignorable="d">
<UserControl.Resources>
<ResourceDictionary>
<Style x:Key="ToggleButtonStyle" TargetType="ToggleButton">
<Style x:Key="ToggleButtonStyle"
TargetType="ToggleButton">
<Setter Property="Width" Value="25" />
<Setter Property="Height" Value="25" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Padding" Value="1" />
<Setter Property="CornerRadius" Value="2"/>
<Setter Property="CornerRadius" Value="2" />
</Style>
<Style x:Key="ButtonStyle" TargetType="Button">
<Style x:Key="ButtonStyle"
TargetType="Button">
<Setter Property="Width" Value="25" />
<Setter Property="Height" Value="25" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="CornerRadius" Value="2"/>
<Setter Property="CornerRadius" Value="2" />
</Style>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Dark">
<Style x:Key="FontIconStyle" TargetType="FontIcon">
<Style x:Key="FontIconStyle"
TargetType="FontIcon">
<Setter Property="FontSize" Value="12" />
</Style>
<Style x:Key="SearchBoxBackground" TargetType="StackPanel">
<Style x:Key="SearchBoxBackground"
TargetType="StackPanel">
<Setter Property="Background" Value="#333333" />
</Style>
<!-- TextBox colors !-->
<SolidColorBrush x:Key="TextControlBackground" Color="#333333"/>
<SolidColorBrush x:Key="TextBoxPlaceholderTextThemeBrush" Color="#B5B5B5"/>
<SolidColorBrush x:Key="TextControlForeground" Color="#B5B5B5"/>
<SolidColorBrush x:Key="TextControlBorderBrush" Color="#404040"/>
<SolidColorBrush x:Key="TextControlButtonForeground" Color="#B5B5B5"/>
<!-- TextBox colors ! -->
<SolidColorBrush x:Key="TextControlBackground"
Color="#333333" />
<SolidColorBrush x:Key="TextBoxPlaceholderTextThemeBrush"
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="TextControlForegroundPointerOver" Color="#FFFFFF"/>
<SolidColorBrush x:Key="TextControlBorderBrushPointerOver" Color="#404040"/>
<SolidColorBrush x:Key="TextControlButtonForegroundPointerOver" Color="#FF4343"/>
<SolidColorBrush x:Key="TextControlBackgroundPointerOver"
Color="#404040" />
<SolidColorBrush x:Key="TextControlForegroundPointerOver"
Color="#FFFFFF" />
<SolidColorBrush x:Key="TextControlBorderBrushPointerOver"
Color="#404040" />
<SolidColorBrush x:Key="TextControlButtonForegroundPointerOver"
Color="#FF4343" />
<SolidColorBrush x:Key="TextControlBackgroundFocused" Color="#333333"/>
<SolidColorBrush x:Key="TextControlForegroundFocused" Color="#FFFFFF"/>
<SolidColorBrush x:Key="TextControlBorderBrushFocused" Color="#404040"/>
<SolidColorBrush x:Key="TextControlButtonForegroundPressed" Color="#FFFFFF"/>
<SolidColorBrush x:Key="TextControlButtonBackgroundPressed" Color="#FF4343"/>
<SolidColorBrush x:Key="TextControlBackgroundFocused"
Color="#333333" />
<SolidColorBrush x:Key="TextControlForegroundFocused"
Color="#FFFFFF" />
<SolidColorBrush x:Key="TextControlBorderBrushFocused"
Color="#404040" />
<SolidColorBrush x:Key="TextControlButtonForegroundPressed"
Color="#FFFFFF" />
<SolidColorBrush x:Key="TextControlButtonBackgroundPressed"
Color="#FF4343" />
<!-- ToggleButton colors !-->
<SolidColorBrush x:Key="ToggleButtonForeground" Color="#B5B5B5"/>
<!-- ToggleButton colors ! -->
<SolidColorBrush x:Key="ToggleButtonForeground"
Color="#B5B5B5" />
<SolidColorBrush x:Key="ToggleButtonBackgroundPointerOver" Color="#404040"/>
<SolidColorBrush x:Key="ToggleButtonForegroundPointerOver" Color="#FFFFFF"/>
<SolidColorBrush x:Key="ToggleButtonBorderBrushPointerOver" Color="Transparent"/>
<SolidColorBrush x:Key="ToggleButtonBackgroundPointerOver"
Color="#404040" />
<SolidColorBrush x:Key="ToggleButtonForegroundPointerOver"
Color="#FFFFFF" />
<SolidColorBrush x:Key="ToggleButtonBorderBrushPointerOver"
Color="Transparent" />
<SolidColorBrush x:Key="ToggleButtonBackgroundPressed" Color="#555555"/>
<SolidColorBrush x:Key="ToggleButtonForegroundPressed" Color="#FFFFFF"/>
<SolidColorBrush x:Key="ToggleButtonBorderBrushPressed" Color="Transparent"/>
<SolidColorBrush x:Key="ToggleButtonBackgroundPressed"
Color="#555555" />
<SolidColorBrush x:Key="ToggleButtonForegroundPressed"
Color="#FFFFFF" />
<SolidColorBrush x:Key="ToggleButtonBorderBrushPressed"
Color="Transparent" />
<SolidColorBrush x:Key="ToggleButtonBackgroundChecked" Color="#555555"/>
<SolidColorBrush x:Key="ToggleButtonForegroundChecked" Color="#FFFFFF"/>
<SolidColorBrush x:Key="ToggleButtonBorderBrushChecked" Color="Transparent"/>
<SolidColorBrush x:Key="ToggleButtonBackgroundChecked"
Color="#555555" />
<SolidColorBrush x:Key="ToggleButtonForegroundChecked"
Color="#FFFFFF" />
<SolidColorBrush x:Key="ToggleButtonBorderBrushChecked"
Color="Transparent" />
<SolidColorBrush x:Key="ToggleButtonBackgroundCheckedPointerOver" Color="#404040"/>
<SolidColorBrush x:Key="ToggleButtonForegroundCheckedPointerOver" Color="#FFFFFF"/>
<SolidColorBrush x:Key="ToggleButtonBorderBrushCheckedPointerOver" Color="Transparent"/>
<SolidColorBrush x:Key="ToggleButtonBackgroundCheckedPointerOver"
Color="#404040" />
<SolidColorBrush x:Key="ToggleButtonForegroundCheckedPointerOver"
Color="#FFFFFF" />
<SolidColorBrush x:Key="ToggleButtonBorderBrushCheckedPointerOver"
Color="Transparent" />
<SolidColorBrush x:Key="ToggleButtonBackgroundCheckedPressed" Color="#555555"/>
<SolidColorBrush x:Key="ToggleButtonForegroundCheckedPressed" Color="#FFFFFF"/>
<SolidColorBrush x:Key="ToggleButtonBorderBrushCheckedPressed" Color="Transparent"/>
<SolidColorBrush x:Key="ToggleButtonBackgroundCheckedPressed"
Color="#555555" />
<SolidColorBrush x:Key="ToggleButtonForegroundCheckedPressed"
Color="#FFFFFF" />
<SolidColorBrush x:Key="ToggleButtonBorderBrushCheckedPressed"
Color="Transparent" />
<!--Button color !-->
<SolidColorBrush x:Key="ButtonBackgroundPointerOver" Color="#404040"/>
<SolidColorBrush x:Key="ButtonForegroundPointerOver" Color="#FFFFFF"/>
<SolidColorBrush x:Key="ButtonBorderBrushPointerOver" Color="Transparent"/>
<!-- Button color ! -->
<SolidColorBrush x:Key="ButtonBackgroundPointerOver"
Color="#404040" />
<SolidColorBrush x:Key="ButtonForegroundPointerOver"
Color="#FFFFFF" />
<SolidColorBrush x:Key="ButtonBorderBrushPointerOver"
Color="Transparent" />
<SolidColorBrush x:Key="ButtonBackgroundPressed" Color="#555555"/>
<SolidColorBrush x:Key="ButtonForegroundPressed" Color="#FFFFFF"/>
<SolidColorBrush x:Key="ButtonBorderBrushPressed" Color="Transparent"/>
<SolidColorBrush x:Key="ButtonBackgroundPressed"
Color="#555555" />
<SolidColorBrush x:Key="ButtonForegroundPressed"
Color="#FFFFFF" />
<SolidColorBrush x:Key="ButtonBorderBrushPressed"
Color="Transparent" />
</ResourceDictionary>
<ResourceDictionary x:Key="Light">
<Style x:Key="FontIconStyle" TargetType="FontIcon">
<Style x:Key="FontIconStyle"
TargetType="FontIcon">
<Setter Property="FontSize" Value="12" />
</Style>
<Style x:Key="SearchBoxBackground" TargetType="StackPanel">
<Style x:Key="SearchBoxBackground"
TargetType="StackPanel">
<Setter Property="Background" Value="#CCCCCC" />
</Style>
<!-- TextBox colors !-->
<SolidColorBrush x:Key="TextControlBackground" Color="#CCCCCC"/>
<SolidColorBrush x:Key="TextBoxPlaceholderTextThemeBrush" Color="#636363"/>
<SolidColorBrush x:Key="TextControlBorderBrush" Color="#636363"/>
<SolidColorBrush x:Key="TextControlButtonForeground" Color="#636363"/>
<!-- TextBox colors ! -->
<SolidColorBrush x:Key="TextControlBackground"
Color="#CCCCCC" />
<SolidColorBrush x:Key="TextBoxPlaceholderTextThemeBrush"
Color="#636363" />
<SolidColorBrush x:Key="TextControlBorderBrush"
Color="#636363" />
<SolidColorBrush x:Key="TextControlButtonForeground"
Color="#636363" />
<SolidColorBrush x:Key="TextControlBackgroundPointerOver" Color="#DADADA"/>
<SolidColorBrush x:Key="TextControlBorderBrushPointerOver" Color="#636363"/>
<SolidColorBrush x:Key="TextControlButtonForegroundPointerOver" Color="#FF4343"/>
<SolidColorBrush x:Key="TextControlBackgroundPointerOver"
Color="#DADADA" />
<SolidColorBrush x:Key="TextControlBorderBrushPointerOver"
Color="#636363" />
<SolidColorBrush x:Key="TextControlButtonForegroundPointerOver"
Color="#FF4343" />
<SolidColorBrush x:Key="TextControlBackgroundFocused" Color="#CCCCCC"/>
<SolidColorBrush x:Key="TextControlBorderBrushFocused" Color="#636363"/>
<SolidColorBrush x:Key="TextControlButtonForegroundPressed" Color="#FFFFFF"/>
<SolidColorBrush x:Key="TextControlButtonBackgroundPressed" Color="#FF4343"/>
<!-- ToggleButton colors !-->
<SolidColorBrush x:Key="ToggleButtonForeground" Color="#636363"/>
<SolidColorBrush x:Key="TextControlBackgroundFocused"
Color="#CCCCCC" />
<SolidColorBrush x:Key="TextControlBorderBrushFocused"
Color="#636363" />
<SolidColorBrush x:Key="TextControlButtonForegroundPressed"
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="ToggleButtonForegroundPointerOver" Color="#000000"/>
<SolidColorBrush x:Key="ToggleButtonBorderBrushPointerOver" Color="Transparent"/>
<SolidColorBrush x:Key="ToggleButtonBackgroundPointerOver"
Color="#DADADA" />
<SolidColorBrush x:Key="ToggleButtonForegroundPointerOver"
Color="#000000" />
<SolidColorBrush x:Key="ToggleButtonBorderBrushPointerOver"
Color="Transparent" />
<SolidColorBrush x:Key="ToggleButtonBackgroundPressed" Color="#B8B8B8"/>
<SolidColorBrush x:Key="ToggleButtonForegroundPressed" Color="#000000"/>
<SolidColorBrush x:Key="ToggleButtonBorderBrushPressed" Color="Transparent"/>
<SolidColorBrush x:Key="ToggleButtonBackgroundPressed"
Color="#B8B8B8" />
<SolidColorBrush x:Key="ToggleButtonForegroundPressed"
Color="#000000" />
<SolidColorBrush x:Key="ToggleButtonBorderBrushPressed"
Color="Transparent" />
<SolidColorBrush x:Key="ToggleButtonBackgroundChecked" Color="#B8B8B8"/>
<SolidColorBrush x:Key="ToggleButtonForegroundChecked" Color="#000000"/>
<SolidColorBrush x:Key="ToggleButtonBorderBrushChecked" Color="Transparent"/>
<SolidColorBrush x:Key="ToggleButtonBackgroundChecked"
Color="#B8B8B8" />
<SolidColorBrush x:Key="ToggleButtonForegroundChecked"
Color="#000000" />
<SolidColorBrush x:Key="ToggleButtonBorderBrushChecked"
Color="Transparent" />
<SolidColorBrush x:Key="ToggleButtonBackgroundCheckedPointerOver" Color="#DADADA"/>
<SolidColorBrush x:Key="ToggleButtonForegroundCheckedPointerOver" Color="#000000"/>
<SolidColorBrush x:Key="ToggleButtonBorderBrushCheckedPointerOver" Color="Transparent"/>
<SolidColorBrush x:Key="ToggleButtonBackgroundCheckedPointerOver"
Color="#DADADA" />
<SolidColorBrush x:Key="ToggleButtonForegroundCheckedPointerOver"
Color="#000000" />
<SolidColorBrush x:Key="ToggleButtonBorderBrushCheckedPointerOver"
Color="Transparent" />
<SolidColorBrush x:Key="ToggleButtonBackgroundCheckedPressed" Color="#B8B8B8"/>
<SolidColorBrush x:Key="ToggleButtonForegroundCheckedPressed" Color="#000000"/>
<SolidColorBrush x:Key="ToggleButtonBorderBrushCheckedPressed" Color="Transparent"/>
<SolidColorBrush x:Key="ToggleButtonBackgroundCheckedPressed"
Color="#B8B8B8" />
<SolidColorBrush x:Key="ToggleButtonForegroundCheckedPressed"
Color="#000000" />
<SolidColorBrush x:Key="ToggleButtonBorderBrushCheckedPressed"
Color="Transparent" />
<!-- Button color !-->
<SolidColorBrush x:Key="ButtonBackgroundPointerOver" Color="#DADADA"/>
<SolidColorBrush x:Key="ButtonForegroundPointerOver" Color="#000000"/>
<SolidColorBrush x:Key="ButtonBorderBrushPointerOver" Color="Transparent"/>
<!-- Button color ! -->
<SolidColorBrush x:Key="ButtonBackgroundPointerOver"
Color="#DADADA" />
<SolidColorBrush x:Key="ButtonForegroundPointerOver"
Color="#000000" />
<SolidColorBrush x:Key="ButtonBorderBrushPointerOver"
Color="Transparent" />
<SolidColorBrush x:Key="ButtonBackgroundPressed" Color="#B8B8B8"/>
<SolidColorBrush x:Key="ButtonForegroundPressed" Color="#000000"/>
<SolidColorBrush x:Key="ButtonBorderBrushPressed" Color="Transparent"/>
<SolidColorBrush x:Key="ButtonBackgroundPressed"
Color="#B8B8B8" />
<SolidColorBrush x:Key="ButtonForegroundPressed"
Color="#000000" />
<SolidColorBrush x:Key="ButtonBorderBrushPressed"
Color="Transparent" />
</ResourceDictionary>
<ResourceDictionary x:Key="HighContrast">
<Style x:Key="FontIconStyle" TargetType="FontIcon">
<Style x:Key="FontIconStyle"
TargetType="FontIcon">
<Setter Property="FontSize" Value="12" />
</Style>
<Style x:Key="SearchBoxBackground" TargetType="StackPanel">
<Style x:Key="SearchBoxBackground"
TargetType="StackPanel">
<Setter Property="Background" Value="{ThemeResource SystemColorWindowColor}" />
</Style>
</ResourceDictionary>
@ -151,38 +227,44 @@
</ResourceDictionary>
</UserControl.Resources>
<StackPanel Orientation="Horizontal" Style="{ThemeResource SearchBoxBackground}" Padding="5" CornerRadius="0,0,2,2">
<TextBox x:Name="TextBox"
x:Uid="SearchBox_TextBox"
CornerRadius="2"
Width="160"
PlaceholderForeground="{ThemeResource TextBoxPlaceholderTextThemeBrush}"
FontSize="15"
KeyDown="TextBoxKeyDown"
Margin="5"
HorizontalAlignment="Left"
VerticalAlignment="Center">
</TextBox>
<StackPanel Padding="5"
CornerRadius="0,0,2,2"
Orientation="Horizontal"
Style="{ThemeResource SearchBoxBackground}">
<TextBox x:Name="TextBox"
x:Uid="SearchBox_TextBox"
Width="160"
Margin="5"
HorizontalAlignment="Left"
VerticalAlignment="Center"
CornerRadius="2"
FontSize="15"
KeyDown="TextBoxKeyDown"
PlaceholderForeground="{ThemeResource TextBoxPlaceholderTextThemeBrush}" />
<ToggleButton x:Name="GoBackwardButton"
x:Uid="SearchBox_SearchBackwards"
HorizontalAlignment="Right"
Style="{StaticResource ToggleButtonStyle}"
Click="GoBackwardClicked"
IsChecked="True">
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE74A;" Style="{ThemeResource FontIconStyle}"/>
IsChecked="True"
Style="{StaticResource ToggleButtonStyle}">
<FontIcon FontFamily="Segoe MDL2 Assets"
Glyph="&#xE74A;"
Style="{ThemeResource FontIconStyle}" />
</ToggleButton>
<ToggleButton x:Name="GoForwardButton"
x:Uid="SearchBox_SearchForwards"
Style="{StaticResource ToggleButtonStyle}"
Click="GoForwardClicked">
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE74B;" Style="{ThemeResource FontIconStyle}"/>
Click="GoForwardClicked"
Style="{StaticResource ToggleButtonStyle}">
<FontIcon FontFamily="Segoe MDL2 Assets"
Glyph="&#xE74B;"
Style="{ThemeResource FontIconStyle}" />
</ToggleButton>
<ToggleButton x:Name="CaseSensitivityButton"
x:Uid="SearchBox_CaseSensitivity"
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>
<Button x:Name="CloseButton"
@ -190,7 +272,9 @@
Padding="0"
Click="CloseClick"
Style="{ThemeResource ButtonStyle}">
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE711;" FontSize="12"/>
<FontIcon FontFamily="Segoe MDL2 Assets"
FontSize="12"
Glyph="&#xE711;" />
</Button>
</StackPanel>
</UserControl>

View File

@ -1,18 +1,17 @@
<UserControl
x:Class="Microsoft.Terminal.Control.TSFInputControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="768"
d:DesignWidth="1024">
<UserControl x:Class="Microsoft.Terminal.Control.TSFInputControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="768"
d:DesignWidth="1024"
mc:Ignorable="d">
<Canvas x:Name="Canvas"
Visibility="Collapsed">
<TextBlock x:Name="TextBlock"
IsTextSelectionEnabled="false"
TextWrapping="Wrap"
TextDecorations="Underline" />
TextDecorations="Underline"
TextWrapping="Wrap" />
</Canvas>
</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. -->
<UserControl
x:Class="Microsoft.Terminal.Control.TermControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.Terminal.Control"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
d:DesignHeight="768"
d:DesignWidth="1024"
TabNavigation="Cycle"
IsTabStop="True"
AllowFocusOnInteraction="True"
AllowDrop="True"
Drop="_DragDropHandler"
DragOver="_DragOverHandler"
Tapped="_TappedHandler"
PointerWheelChanged="_MouseWheelHandler"
PreviewKeyDown="_KeyDownHandler"
KeyUp="_KeyUpHandler"
CharacterReceived="_CharacterHandler"
GotFocus="_GotFocusHandler"
LostFocus="_LostFocusHandler">
<!--
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
the MIT License. See LICENSE in the project root for license information.
-->
<UserControl x:Class="Microsoft.Terminal.Control.TermControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.Terminal.Control"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
d:DesignHeight="768"
d:DesignWidth="1024"
AllowDrop="True"
AllowFocusOnInteraction="True"
CharacterReceived="_CharacterHandler"
DragOver="_DragOverHandler"
Drop="_DragDropHandler"
GotFocus="_GotFocusHandler"
IsTabStop="True"
KeyUp="_KeyUpHandler"
LostFocus="_LostFocusHandler"
PointerWheelChanged="_MouseWheelHandler"
PreviewKeyDown="_KeyDownHandler"
TabNavigation="Cycle"
Tapped="_TappedHandler"
mc:Ignorable="d">
<!--
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
@ -41,16 +42,16 @@ the MIT License. See LICENSE in the project root for license information. -->
</Grid.ColumnDefinitions>
<Grid Grid.Column="0"
Visibility="Visible"
Background="Transparent"
PointerPressed="_PointerPressedHandler"
PointerExited="_PointerExitedHandler"
PointerMoved="_PointerMovedHandler"
PointerPressed="_PointerPressedHandler"
PointerReleased="_PointerReleasedHandler"
PointerExited="_PointerExitedHandler">
Visibility="Visible">
<SwapChainPanel x:Name="SwapChainPanel"
SizeChanged="_SwapChainSizeChanged"
CompositionScaleChanged="_SwapChainScaleChanged">
CompositionScaleChanged="_SwapChainScaleChanged"
SizeChanged="_SwapChainSizeChanged">
<Canvas x:Name="OverlayCanvas"
Visibility="Visible">
@ -60,10 +61,9 @@ the MIT License. See LICENSE in the project root for license information. -->
<ToolTip x:Name="LinkTip"
Placement="Mouse">
<TextBlock IsTextSelectionEnabled="True">
<Run x:Name="HoveredUri"/> <LineBreak />
<Run x:Name="HoveredUri" /> <LineBreak />
<Run x:Uid="HowToOpenRun"
FontStyle="Italic">
</Run>
FontStyle="Italic" />
</TextBlock>
</ToolTip>
</ToolTipService.ToolTip>
@ -71,31 +71,33 @@ the MIT License. See LICENSE in the project root for license information. -->
</Canvas>
</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"
x:Load="False"
Visibility="Collapsed"
HorizontalAlignment="Right"
VerticalAlignment="Top"
x:Load="False"
Closed="_CloseSearchBoxControl"
Search="_Search"
Closed="_CloseSearchBoxControl" />
Visibility="Collapsed" />
</Grid>
<ScrollBar Grid.Column="1"
x:Name="ScrollBar"
Orientation="Vertical"
IndicatorMode="MouseIndicator"
<ScrollBar x:Name="ScrollBar"
Grid.Column="1"
HorizontalAlignment="Right"
VerticalAlignment="Stretch"
Maximum="1"
ViewportSize="10"
IndicatorMode="MouseIndicator"
IsTabStop="False"
SmallChange="1"
LargeChange="4"
ValueChanged="_ScrollbarChangeHandler"
Maximum="1"
Orientation="Vertical"
PointerPressed="_CapturePointer"
PointerReleased="_ReleasePointerCapture" />
PointerReleased="_ReleasePointerCapture"
SmallChange="1"
ValueChanged="_ScrollbarChangeHandler"
ViewportSize="10" />
</Grid>
<local:TSFInputControl x:Name="TSFInputControl"
@ -104,18 +106,22 @@ the MIT License. See LICENSE in the project root for license information. -->
CurrentFontInfo="_FontInfoHandler" />
<Grid x:Name="RendererFailedNotice"
x:Load="False"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<Border Background="{ThemeResource SystemControlBackgroundAltHighBrush}"
BorderBrush="{ThemeResource SystemAccentColor}"
Margin="8,8,8,8"
VerticalAlignment="Center"
x:Load="False">
<Border Margin="8,8,8,8"
Padding="8,8,8,8"
Background="{ThemeResource SystemControlBackgroundAltHighBrush}"
BorderBrush="{ThemeResource SystemAccentColor}"
BorderThickness="2,2,2,2"
CornerRadius="{ThemeResource OverlayCornerRadius}">
<StackPanel>
<TextBlock HorizontalAlignment="Center" x:Uid="TermControl_RendererFailedTextBlock" TextWrapping="WrapWholeWords"/>
<Button Click="_RenderRetryButton_Click" x:Uid="TermControl_RendererRetryButton" HorizontalAlignment="Right" />
<TextBlock x:Uid="TermControl_RendererFailedTextBlock"
HorizontalAlignment="Center"
TextWrapping="WrapWholeWords" />
<Button x:Uid="TermControl_RendererRetryButton"
HorizontalAlignment="Right"
Click="_RenderRetryButton_Click" />
</StackPanel>
</Border>
</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. -->
<Page
x:Class="Microsoft.Terminal.Settings.Editor.Actions"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
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:muxc="using:Microsoft.UI.Xaml.Controls"
xmlns:SettingsModel="using:Microsoft.Terminal.Settings.Model"
mc:Ignorable="d">
<!--
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
the MIT License. See LICENSE in the project root for license information.
-->
<Page x:Class="Microsoft.Terminal.Settings.Editor.Actions"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:SettingsModel="using:Microsoft.Terminal.Settings.Model"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.Terminal.Settings.Editor"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
mc:Ignorable="d">
<Page.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="CommonResources.xaml"/>
<ResourceDictionary Source="CommonResources.xaml" />
</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
not filtering this list
not filtering this list
* We don't need the chevron for nested commands
* We're not displaying the icon
* We're binding directly to a Command, not a FilteredCommand
If we wanted to reuse the command palette's list more directly,
that's theoretically possible, but then it would need to be
lifted out of TerminalApp and either moved into the
TerminalSettingsEditor or moved to it's own project consumed by
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"
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>
<ColumnDefinition Width="16"/>
<!-- icon -->
<ColumnDefinition Width="Auto"/>
<!-- command label -->
<ColumnDefinition Width="*"/>
<!-- key chord -->
<ColumnDefinition Width="32"/>
<!-- gutter for scrollbar -->
<ColumnDefinition Width="16" />
<!-- icon -->
<ColumnDefinition Width="Auto" />
<!-- command label -->
<ColumnDefinition Width="*" />
<!-- key chord -->
<ColumnDefinition Width="32" />
<!-- gutter for scrollbar -->
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="1"
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
CommandKeyChordVisibilityConverter for details.
Inexplicably, we don't need to set the
AutomationProperties to Raw here, unlike in the
CommandPalette. We're not quite sure why.-->
<!--
The block for the key chord is only visible
when there's actual text set as the label. See
CommandKeyChordVisibilityConverter for details.
Inexplicably, we don't need to set the
AutomationProperties to Raw here, unlike in the
CommandPalette. We're not quite sure why.
-->
<Border Grid.Column="2"
Visibility="{x:Bind KeyChordText,
Mode=OneWay,
Converter={StaticResource CommandKeyChordVisibilityConverter}}"
Style="{ThemeResource KeyChordBorderStyle}"
Padding="2,0,2,0"
HorizontalAlignment="Right"
VerticalAlignment="Center">
VerticalAlignment="Center"
Style="{ThemeResource KeyChordBorderStyle}"
Visibility="{x:Bind KeyChordText, Mode=OneWay, Converter={StaticResource CommandKeyChordVisibilityConverter}}">
<TextBlock Style="{ThemeResource KeyChordTextBlockStyle}"
FontSize="12"
<TextBlock FontSize="12"
Style="{ThemeResource KeyChordTextBlockStyle}"
Text="{x:Bind KeyChordText, Mode=OneWay}" />
</Border>
</Grid>
</ListViewItem>
</DataTemplate>
<!-- These resources again, HEAVILY copied from the command palette -->
<!-- These resources again, HEAVILY copied from the command palette -->
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Dark">
<!-- TextBox colors !-->
<SolidColorBrush x:Key="TextControlBackground" Color="#333333"/>
<SolidColorBrush x:Key="TextBoxPlaceholderTextThemeBrush" Color="#B5B5B5"/>
<SolidColorBrush x:Key="TextControlForeground" Color="#B5B5B5"/>
<SolidColorBrush x:Key="TextControlBorderBrush" Color="#404040"/>
<SolidColorBrush x:Key="TextControlButtonForeground" Color="#B5B5B5"/>
<!-- TextBox colors ! -->
<SolidColorBrush x:Key="TextControlBackground"
Color="#333333" />
<SolidColorBrush x:Key="TextBoxPlaceholderTextThemeBrush"
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="TextControlForegroundPointerOver" Color="#FFFFFF"/>
<SolidColorBrush x:Key="TextControlBorderBrushPointerOver" Color="#404040"/>
<SolidColorBrush x:Key="TextControlButtonForegroundPointerOver" Color="#FF4343"/>
<SolidColorBrush x:Key="TextControlBackgroundPointerOver"
Color="#404040" />
<SolidColorBrush x:Key="TextControlForegroundPointerOver"
Color="#FFFFFF" />
<SolidColorBrush x:Key="TextControlBorderBrushPointerOver"
Color="#404040" />
<SolidColorBrush x:Key="TextControlButtonForegroundPointerOver"
Color="#FF4343" />
<SolidColorBrush x:Key="TextControlBackgroundFocused" Color="#333333"/>
<SolidColorBrush x:Key="TextControlForegroundFocused" Color="#FFFFFF"/>
<SolidColorBrush x:Key="TextControlBorderBrushFocused" Color="#404040"/>
<SolidColorBrush x:Key="TextControlButtonForegroundPressed" Color="#FFFFFF"/>
<SolidColorBrush x:Key="TextControlButtonBackgroundPressed" Color="#FF4343"/>
<SolidColorBrush x:Key="TextControlBackgroundFocused"
Color="#333333" />
<SolidColorBrush x:Key="TextControlForegroundFocused"
Color="#FFFFFF" />
<SolidColorBrush x:Key="TextControlBorderBrushFocused"
Color="#404040" />
<SolidColorBrush x:Key="TextControlButtonForegroundPressed"
Color="#FFFFFF" />
<SolidColorBrush x:Key="TextControlButtonBackgroundPressed"
Color="#FF4343" />
<!-- KeyChordText styles -->
<Style x:Key="KeyChordBorderStyle" TargetType="Border">
<Style x:Key="KeyChordBorderStyle"
TargetType="Border">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="1" />
<Setter Property="Background" Value="{ThemeResource SystemAltMediumLowColor}" />
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
</Style>
<Style x:Key="KeyChordTextBlockStyle" TargetType="TextBlock">
<Style x:Key="KeyChordTextBlockStyle"
TargetType="TextBlock">
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
</Style>
</ResourceDictionary>
<ResourceDictionary x:Key="Light">
<!-- TextBox colors !-->
<SolidColorBrush x:Key="TextControlBackground" Color="#CCCCCC"/>
<SolidColorBrush x:Key="TextBoxPlaceholderTextThemeBrush" Color="#636363"/>
<SolidColorBrush x:Key="TextControlBorderBrush" Color="#636363"/>
<SolidColorBrush x:Key="TextControlButtonForeground" Color="#636363"/>
<!-- TextBox colors ! -->
<SolidColorBrush x:Key="TextControlBackground"
Color="#CCCCCC" />
<SolidColorBrush x:Key="TextBoxPlaceholderTextThemeBrush"
Color="#636363" />
<SolidColorBrush x:Key="TextControlBorderBrush"
Color="#636363" />
<SolidColorBrush x:Key="TextControlButtonForeground"
Color="#636363" />
<SolidColorBrush x:Key="TextControlBackgroundPointerOver" Color="#DADADA"/>
<SolidColorBrush x:Key="TextControlBorderBrushPointerOver" Color="#636363"/>
<SolidColorBrush x:Key="TextControlButtonForegroundPointerOver" Color="#FF4343"/>
<SolidColorBrush x:Key="TextControlBackgroundPointerOver"
Color="#DADADA" />
<SolidColorBrush x:Key="TextControlBorderBrushPointerOver"
Color="#636363" />
<SolidColorBrush x:Key="TextControlButtonForegroundPointerOver"
Color="#FF4343" />
<SolidColorBrush x:Key="TextControlBackgroundFocused" Color="#CCCCCC"/>
<SolidColorBrush x:Key="TextControlBorderBrushFocused" Color="#636363"/>
<SolidColorBrush x:Key="TextControlButtonForegroundPressed" Color="#FFFFFF"/>
<SolidColorBrush x:Key="TextControlButtonBackgroundPressed" Color="#FF4343"/>
<SolidColorBrush x:Key="TextControlBackgroundFocused"
Color="#CCCCCC" />
<SolidColorBrush x:Key="TextControlBorderBrushFocused"
Color="#636363" />
<SolidColorBrush x:Key="TextControlButtonForegroundPressed"
Color="#FFFFFF" />
<SolidColorBrush x:Key="TextControlButtonBackgroundPressed"
Color="#FF4343" />
<!-- KeyChordText styles -->
<Style x:Key="KeyChordBorderStyle" TargetType="Border">
<Style x:Key="KeyChordBorderStyle"
TargetType="Border">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="1" />
<Setter Property="Background" Value="{ThemeResource SystemAltMediumLowColor}" />
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
</Style>
<Style x:Key="KeyChordTextBlockStyle" TargetType="TextBlock">
<Style x:Key="KeyChordTextBlockStyle"
TargetType="TextBlock">
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
</Style>
</ResourceDictionary>
<ResourceDictionary x:Key="HighContrast">
<!-- KeyChordText styles (use XAML defaults for High Contrast theme) -->
<Style x:Key="KeyChordBorderStyle" TargetType="Border"/>
<Style x:Key="KeyChordTextBlockStyle" TargetType="TextBlock"/>
<!-- KeyChordText styles (use XAML defaults for High Contrast theme) -->
<Style x:Key="KeyChordBorderStyle"
TargetType="Border" />
<Style x:Key="KeyChordTextBlockStyle"
TargetType="TextBlock" />
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
@ -157,30 +194,34 @@ the MIT License. See LICENSE in the project root for license information. -->
<ScrollViewer>
<StackPanel Style="{StaticResource SettingsStackStyle}">
<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"
Click="_OpenSettingsClick" />
<!-- Keybindings -->
<!-- Keybindings -->
<!-- NOTE: Globals_Keybindings.Header is not defined, because that
would result in the page having "Keybindings" displayed twice, which
looks quite redundant -->
<ContentPresenter x:Uid="Globals_Keybindings" Margin="0">
<!--
NOTE: Globals_Keybindings.Header is not defined, because that
would result in the page having "Keybindings" displayed twice, which
looks quite redundant
-->
<ContentPresenter x:Uid="Globals_Keybindings"
Margin="0">
<ListView HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
SelectionMode="None"
IsItemClickEnabled="False"
CanReorderItems="False"
AllowDrop="False"
CanReorderItems="False"
IsItemClickEnabled="False"
ItemTemplate="{StaticResource GeneralItemTemplate}"
ItemsSource="{x:Bind FilteredActions, Mode=OneWay}"
ItemTemplate="{StaticResource GeneralItemTemplate}">
</ListView>
SelectionMode="None" />
</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. -->
<Page
x:Class="Microsoft.Terminal.Settings.Editor.ColorSchemes"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Microsoft.Terminal.Settings.Editor"
xmlns:model="using:Microsoft.Terminal.Settings.Model"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<!--
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
the MIT License. See LICENSE in the project root for license information.
-->
<Page x:Class="Microsoft.Terminal.Settings.Editor.ColorSchemes"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.Terminal.Settings.Editor"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:model="using:Microsoft.Terminal.Settings.Model"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
mc:Ignorable="d">
<Page.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="CommonResources.xaml"/>
<ResourceDictionary Source="CommonResources.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style x:Key="GroupHeaderStyle" TargetType="TextBlock" BasedOn="{StaticResource SubtitleTextBlockStyle}">
<Setter Property="Margin" Value="0,0,0,4"/>
<Style x:Key="GroupHeaderStyle"
BasedOn="{StaticResource SubtitleTextBlockStyle}"
TargetType="TextBlock">
<Setter Property="Margin" Value="0,0,0,4" />
</Style>
<Style x:Key="ColorLabelStyle" TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Style x:Key="ColorLabelStyle"
TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
<Style x:Key="ColorTableGridStyle" TargetType="Grid">
<Setter Property="RowSpacing" Value="10"/>
<Setter Property="ColumnSpacing" Value="10"/>
<Style x:Key="ColorTableGridStyle"
TargetType="Grid">
<Setter Property="RowSpacing" Value="10" />
<Setter Property="ColumnSpacing" Value="10" />
</Style>
<Style x:Key="ColorControlStyle" TargetType="ContentControl">
<Setter Property="IsTabStop" Value="False"/>
<Style x:Key="ColorControlStyle"
TargetType="ContentControl">
<Setter Property="IsTabStop" Value="False" />
</Style>
<Style x:Key="ColorButtonStyle" TargetType="Button" BasedOn="{StaticResource BaseButtonStyle}">
<Setter Property="BorderBrush" Value="{StaticResource SystemBaseLowColor}"/>
<Setter Property="Height" Value="30"/>
<Setter Property="Width" Value="100"/>
<Style x:Key="ColorButtonStyle"
BasedOn="{StaticResource BaseButtonStyle}"
TargetType="Button">
<Setter Property="BorderBrush" Value="{StaticResource SystemBaseLowColor}" />
<Setter Property="Height" Value="30" />
<Setter Property="Width" Value="100" />
</Style>
<Style TargetType="ColorPicker">
<Setter Property="IsColorSliderVisible" Value="False"/>
<Setter Property="IsColorChannelTextInputVisible" Value="False"/>
<Setter Property="IsHexInputVisible" Value="True"/>
<Setter Property="IsAlphaSliderVisible" Value="True"/>
<Setter Property="IsAlphaTextInputVisible" Value="True"/>
<Setter Property="IsColorSliderVisible" Value="False" />
<Setter Property="IsColorChannelTextInputVisible" Value="False" />
<Setter Property="IsHexInputVisible" Value="True" />
<Setter Property="IsAlphaSliderVisible" Value="True" />
<Setter Property="IsAlphaTextInputVisible" Value="True" />
</Style>
<DataTemplate x:Key="ColorTableEntryTemplate" x:DataType="local:ColorTableEntry">
<Button Background="{x:Bind Color, Converter={StaticResource ColorToBrushConverter}, Mode=OneWay}"
ToolTipService.ToolTip="{x:Bind Name}"
AutomationProperties.Name="{x:Bind Name}"
Style="{StaticResource ColorButtonStyle}">
<DataTemplate x:Key="ColorTableEntryTemplate"
x:DataType="local:ColorTableEntry">
<Button AutomationProperties.Name="{x:Bind Name}"
Background="{x:Bind Color, Converter={StaticResource ColorToBrushConverter}, Mode=OneWay}"
Style="{StaticResource ColorButtonStyle}"
ToolTipService.ToolTip="{x:Bind Name}">
<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.ThemeDictionaries>
<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 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>
<!-- No High contrast dictionary, let's just leave that unchanged. -->
<!-- No High contrast dictionary, let's just leave that unchanged. -->
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>
</Button.Resources>
<Button.Flyout>
<Flyout>
<ColorPicker Tag="{x:Bind Tag, Mode=OneWay}"
Color="{x:Bind Color, Mode=OneWay}"
ColorChanged="ColorPickerChanged"/>
<ColorPicker ColorChanged="ColorPickerChanged"
Tag="{x:Bind Tag, Mode=OneWay}"
Color="{x:Bind Color, Mode=OneWay}" />
</Flyout>
</Button.Flyout>
</Button>
</DataTemplate>
<local:ColorToBrushConverter x:Key="ColorToBrushConverter"/>
<local:ColorToHexConverter x:Key="ColorToHexConverter"/>
<local:InvertedBooleanToVisibilityConverter x:Key="InvertedBooleanToVisibilityConverter"/>
<local:ColorLightenConverter x:Key="ColorLightenConverter"/>
<local:ColorToBrushConverter x:Key="ColorToBrushConverter" />
<local:ColorToHexConverter x:Key="ColorToHexConverter" />
<local:InvertedBooleanToVisibilityConverter x:Key="InvertedBooleanToVisibilityConverter" />
<local:ColorLightenConverter x:Key="ColorLightenConverter" />
</ResourceDictionary>
</Page.Resources>
<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}"
Spacing="24">
<!--Select Color and Add New Button-->
<!-- Select Color and Add New Button -->
<StackPanel Orientation="Horizontal">
<StackPanel Orientation="Horizontal"
Visibility="{x:Bind IsRenaming, Converter={StaticResource InvertedBooleanToVisibilityConverter}, Mode=OneWay}">
<!--Select a color scheme-->
<!-- Select a color scheme -->
<ComboBox x:Name="ColorSchemeComboBox"
SelectedIndex="0"
ItemsSource="{x:Bind ColorSchemeList, Mode=OneWay}"
SelectedIndex="0"
SelectionChanged="ColorSchemeSelectionChanged"
Style="{StaticResource ComboBoxSettingStyle}">
<ComboBox.ItemTemplate>
<DataTemplate x:DataType="model:ColorScheme">
<TextBlock Text="{x:Bind Name, Mode=OneWay}"/>
<TextBlock Text="{x:Bind Name, Mode=OneWay}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<!--Rename Button-->
<!--Bind IsEnabled to prevent a the color scheme from returning from the dead-->
<Button x:Uid="Rename"
x:Name="RenameButton"
Style="{StaticResource SmallButtonStyle}"
<!-- Rename Button -->
<!-- Bind IsEnabled to prevent a the color scheme from returning from the dead -->
<Button x:Name="RenameButton"
x:Uid="Rename"
Click="Rename_Click"
IsEnabled="{x:Bind CanDeleteCurrentScheme, Mode=OneWay}">
IsEnabled="{x:Bind CanDeleteCurrentScheme, Mode=OneWay}"
Style="{StaticResource SmallButtonStyle}">
<StackPanel Orientation="Horizontal">
<FontIcon Glyph="&#xE8AC;"
FontSize="{StaticResource StandardIconSize}"/>
<FontIcon FontSize="{StaticResource StandardIconSize}"
Glyph="&#xE8AC;" />
</StackPanel>
</Button>
</StackPanel>
@ -142,152 +137,152 @@ the MIT License. See LICENSE in the project root for license information. -->
<StackPanel Orientation="Horizontal"
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"
x:Uid="ColorScheme_RenameErrorTip"/>
x:Uid="ColorScheme_RenameErrorTip" />
<!--Name text box-->
<!-- Name text box -->
<TextBox x:Name="NameBox"
Style="{StaticResource TextBoxSettingStyle}"
PreviewKeyDown="NameBox_PreviewKeyDown"/>
PreviewKeyDown="NameBox_PreviewKeyDown"
Style="{StaticResource TextBoxSettingStyle}" />
<!--Accept rename button-->
<Button x:Uid="RenameAccept"
x:Name="RenameAcceptButton"
Style="{StaticResource AccentSmallButtonStyle}"
Click="RenameAccept_Click">
<!-- Accept rename button -->
<Button x:Name="RenameAcceptButton"
x:Uid="RenameAccept"
Click="RenameAccept_Click"
Style="{StaticResource AccentSmallButtonStyle}">
<StackPanel Orientation="Horizontal">
<FontIcon Glyph="&#xE8FB;"
FontSize="{StaticResource StandardIconSize}"/>
<FontIcon FontSize="{StaticResource StandardIconSize}"
Glyph="&#xE8FB;" />
</StackPanel>
</Button>
<!--Cancel rename button-->
<Button x:Uid="RenameCancel"
x:Name="RenameCancelButton"
Style="{StaticResource SmallButtonStyle}"
Click="RenameCancel_Click">
<!-- Cancel rename button -->
<Button x:Name="RenameCancelButton"
x:Uid="RenameCancel"
Click="RenameCancel_Click"
Style="{StaticResource SmallButtonStyle}">
<StackPanel Orientation="Horizontal">
<FontIcon Glyph="&#xE711;"
FontSize="{StaticResource StandardIconSize}"/>
<FontIcon FontSize="{StaticResource StandardIconSize}"
Glyph="&#xE711;" />
</StackPanel>
</Button>
</StackPanel>
<!--Add new button-->
<!-- Add new button -->
<Button x:Name="AddNewButton"
Click="AddNew_Click"
Style="{StaticResource BrowseButtonStyle}">
<StackPanel Orientation="Horizontal">
<FontIcon Glyph="&#xE710;"
FontSize="{StaticResource StandardIconSize}"/>
<FontIcon FontSize="{StaticResource StandardIconSize}"
Glyph="&#xE710;" />
<TextBlock x:Uid="ColorScheme_AddNewButton"
Style="{StaticResource IconButtonTextBlockStyle}"/>
Style="{StaticResource IconButtonTextBlockStyle}" />
</StackPanel>
</Button>
</StackPanel>
<!-- Terminal Colors (Left Column)-->
<!-- Terminal Colors (Left Column) -->
<StackPanel x:Name="ColorPanel"
Spacing="48">
<StackPanel>
<TextBlock x:Uid="ColorScheme_TerminalColorsHeader"
Style="{StaticResource GroupHeaderStyle}"/>
Style="{StaticResource GroupHeaderStyle}" />
<Grid x:Name="ColorTableGrid"
Style="{StaticResource ColorTableGridStyle}">
<Grid.ColumnDefinitions>
<!--Labels-->
<ColumnDefinition Width="Auto"/>
<!-- Labels -->
<ColumnDefinition Width="Auto" />
<!--Regular Colors-->
<ColumnDefinition Width="Auto"/>
<!-- Regular Colors -->
<ColumnDefinition Width="Auto" />
<!--Bright Colors-->
<ColumnDefinition Width="Auto"/>
<!-- Bright Colors -->
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<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>
</StackPanel>
<!-- System Colors (Right Column) -->
<!-- System Colors (Right Column) -->
<StackPanel>
<TextBlock x:Uid="ColorScheme_SystemColorsHeader"
Style="{StaticResource GroupHeaderStyle}"/>
Style="{StaticResource GroupHeaderStyle}" />
<Grid Style="{StaticResource ColorTableGridStyle}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<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>
<!--Foreground-->
<!-- Foreground -->
<TextBlock x:Uid="ColorScheme_Foreground"
Style="{StaticResource ColorLabelStyle}"
Grid.Row="0"
Grid.Column="0"/>
Grid.Column="0"
Style="{StaticResource ColorLabelStyle}" />
<ContentControl x:Name="ForegroundButton"
ContentTemplate="{StaticResource ColorTableEntryTemplate}"
Content="{x:Bind CurrentForegroundColor, Mode=TwoWay}"
Style="{StaticResource ColorControlStyle}"
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"
Style="{StaticResource ColorLabelStyle}"
Grid.Row="1"
Grid.Column="0"/>
Grid.Column="0"
Style="{StaticResource ColorLabelStyle}" />
<ContentControl x:Name="BackgroundButton"
ContentTemplate="{StaticResource ColorTableEntryTemplate}"
Content="{x:Bind CurrentBackgroundColor, Mode=TwoWay}"
Style="{StaticResource ColorControlStyle}"
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"
Style="{StaticResource ColorLabelStyle}"
Grid.Row="2"
Grid.Column="0"/>
Grid.Column="0"
Style="{StaticResource ColorLabelStyle}" />
<ContentControl x:Name="CursorColorButton"
ContentTemplate="{StaticResource ColorTableEntryTemplate}"
Content="{x:Bind CurrentCursorColor, Mode=TwoWay}"
Style="{StaticResource ColorControlStyle}"
Grid.Row="2"
Grid.Column="1"/>
<!--Selection Background-->
<TextBlock x:Uid="ColorScheme_SelectionBackground"
Style="{StaticResource ColorLabelStyle}"
Grid.Row="3"
Grid.Column="0"/>
<ContentControl x:Name="SelectionBackgroundButton"
Grid.Column="1"
Content="{x:Bind CurrentCursorColor, Mode=TwoWay}"
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.Column="1"/>
Grid.Column="1"
Content="{x:Bind CurrentSelectionBackgroundColor, Mode=TwoWay}"
ContentTemplate="{StaticResource ColorTableEntryTemplate}"
Style="{StaticResource ColorControlStyle}" />
</Grid>
</StackPanel>
</StackPanel>
<!--Delete Button-->
<!-- Delete Button -->
<StackPanel Style="{StaticResource PivotStackStyle}">
<Button x:Name="DeleteButton"
IsEnabled="{x:Bind CanDeleteCurrentScheme, Mode=OneWay}"
@ -296,54 +291,89 @@ the MIT License. See LICENSE in the project root for license information. -->
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Light">
<SolidColorBrush x:Key="ButtonBackground" Color="Firebrick"/>
<SolidColorBrush x:Key="ButtonBackgroundPointerOver" Color="#C23232"/>
<SolidColorBrush x:Key="ButtonBackgroundPressed" Color="#A21212"/>
<SolidColorBrush x:Key="ButtonForeground" Color="White"/>
<SolidColorBrush x:Key="ButtonForegroundPointerOver" Color="White"/>
<SolidColorBrush x:Key="ButtonForegroundPressed" Color="White"/>
<SolidColorBrush x:Key="ButtonBackground"
Color="Firebrick" />
<SolidColorBrush x:Key="ButtonBackgroundPointerOver"
Color="#C23232" />
<SolidColorBrush x:Key="ButtonBackgroundPressed"
Color="#A21212" />
<SolidColorBrush x:Key="ButtonForeground"
Color="White" />
<SolidColorBrush x:Key="ButtonForegroundPointerOver"
Color="White" />
<SolidColorBrush x:Key="ButtonForegroundPressed"
Color="White" />
</ResourceDictionary>
<ResourceDictionary x:Key="Dark">
<SolidColorBrush x:Key="ButtonBackground" Color="Firebrick"/>
<SolidColorBrush x:Key="ButtonBackgroundPointerOver" Color="#C23232"/>
<SolidColorBrush x:Key="ButtonBackgroundPressed" Color="#A21212"/>
<SolidColorBrush x:Key="ButtonForeground" Color="White"/>
<SolidColorBrush x:Key="ButtonForegroundPointerOver" Color="White"/>
<SolidColorBrush x:Key="ButtonForegroundPressed" Color="White"/>
<SolidColorBrush x:Key="ButtonBackground"
Color="Firebrick" />
<SolidColorBrush x:Key="ButtonBackgroundPointerOver"
Color="#C23232" />
<SolidColorBrush x:Key="ButtonBackgroundPressed"
Color="#A21212" />
<SolidColorBrush x:Key="ButtonForeground"
Color="White" />
<SolidColorBrush x:Key="ButtonForegroundPointerOver"
Color="White" />
<SolidColorBrush x:Key="ButtonForegroundPressed"
Color="White" />
</ResourceDictionary>
<ResourceDictionary x:Key="HighContrast">
<SolidColorBrush x:Key="ButtonBackground" Color="{ThemeResource SystemColorButtonFaceColor}"/>
<SolidColorBrush x:Key="ButtonBackgroundPointerOver" Color="{ThemeResource SystemColorHighlightColor}"/>
<SolidColorBrush x:Key="ButtonBackgroundPressed" Color="{ThemeResource SystemColorHighlightColor}"/>
<SolidColorBrush x:Key="ButtonForeground" Color="{ThemeResource SystemColorButtonTextColor}"/>
<SolidColorBrush x:Key="ButtonForegroundPointerOver" Color="{ThemeResource SystemColorHighlightTextColor}"/>
<SolidColorBrush x:Key="ButtonForegroundPressed" Color="{ThemeResource SystemColorHighlightTextColor}"/>
<SolidColorBrush x:Key="ButtonBackground"
Color="{ThemeResource SystemColorButtonFaceColor}" />
<SolidColorBrush x:Key="ButtonBackgroundPointerOver"
Color="{ThemeResource SystemColorHighlightColor}" />
<SolidColorBrush x:Key="ButtonBackgroundPressed"
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.ThemeDictionaries>
</ResourceDictionary>
</Button.Resources>
<Button.Content>
<StackPanel Orientation="Horizontal">
<FontIcon Glyph="&#xE74D;"/>
<FontIcon Glyph="&#xE74D;" />
<TextBlock x:Uid="ColorScheme_DeleteButton"
Style="{StaticResource IconButtonTextBlockStyle}"/>
Style="{StaticResource IconButtonTextBlockStyle}" />
</StackPanel>
</Button.Content>
<Button.Flyout>
<Flyout>
<StackPanel>
<TextBlock x:Uid="ColorScheme_DeleteConfirmationMessage"
Style="{StaticResource CustomFlyoutTextStyle}"/>
<Button x:Uid="ColorScheme_DeleteConfirmationButton"
Click="DeleteConfirmation_Click"/>
Style="{StaticResource CustomFlyoutTextStyle}" />
<Button x:Uid="ColorScheme_DeleteConfirmationButton"
Click="DeleteConfirmation_Click" />
</StackPanel>
</Flyout>
</Button.Flyout>
</Button>
<TextBlock x:Name="DeleteButtonDisclaimer"
Style="{StaticResource DisclaimerStyle}"
VerticalAlignment="Center"/>
VerticalAlignment="Center"
Style="{StaticResource DisclaimerStyle}" />
</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>
</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. -->
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls">
<!--
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
the MIT License. See LICENSE in the project root for license information.
-->
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
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 Source="SettingContainerStyle.xaml"/>
<ResourceDictionary Source="SettingContainerStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
<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>
<x:Double x:Key="StandardBoxMinWidth">250</x:Double>
<!-- This is for styling the entire items control used on the
color schemes page-->
<Style x:Key="ItemsControlStyle" TargetType="ItemsControl">
<Setter Property="Margin" Value="{StaticResource StandardControlMargin}"/>
<!--
This is for styling the entire items control used on the
color schemes page
-->
<Style x:Key="ItemsControlStyle"
TargetType="ItemsControl">
<Setter Property="Margin" Value="{StaticResource StandardControlMargin}" />
</Style>
<!--Used to stack a group of settings-->
<Style x:Key="SettingsStackStyle" TargetType="StackPanel">
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="Margin" Value="13,0,0,48"/>
<!-- Used to stack a group of settings -->
<Style x:Key="SettingsStackStyle"
TargetType="StackPanel">
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="Margin" Value="13,0,0,48" />
</Style>
<!--Used to stack a group of settings inside a pivot-->
<Style x:Key="PivotStackStyle" TargetType="StackPanel">
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="Margin" Value="0,0,0,48"/>
<!-- Used to stack a group of settings inside a pivot -->
<Style x:Key="PivotStackStyle"
TargetType="StackPanel">
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="Margin" Value="0,0,0,48" />
</Style>
<!--Combo Box-->
<Style x:Key="ComboBoxSettingStyle" TargetType="ComboBox" BasedOn="{StaticResource DefaultComboBoxStyle}">
<Setter Property="MinWidth" Value="{StaticResource StandardBoxMinWidth}"/>
<!-- Combo Box -->
<Style x:Key="ComboBoxSettingStyle"
BasedOn="{StaticResource DefaultComboBoxStyle}"
TargetType="ComboBox">
<Setter Property="MinWidth" Value="{StaticResource StandardBoxMinWidth}" />
</Style>
<!--Text Box-->
<Style x:Key="TextBoxSettingStyle" TargetType="TextBox" BasedOn="{StaticResource DefaultTextBoxStyle}">
<Setter Property="Width" Value="{StaticResource StandardBoxMinWidth}"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="TextWrapping" Value="Wrap"/>
<!-- Text Box -->
<Style x:Key="TextBoxSettingStyle"
BasedOn="{StaticResource DefaultTextBoxStyle}"
TargetType="TextBox">
<Setter Property="Width" Value="{StaticResource StandardBoxMinWidth}" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="TextWrapping" Value="Wrap" />
</Style>
<!--Used for disclaimers-->
<Style x:Key="DisclaimerStyle" TargetType="TextBlock">
<Setter Property="FontStyle" Value="Italic"/>
<Setter Property="TextWrapping" Value="WrapWholeWords"/>
<!-- Used for disclaimers -->
<Style x:Key="DisclaimerStyle"
TargetType="TextBlock">
<Setter Property="FontStyle" Value="Italic" />
<Setter Property="TextWrapping" Value="WrapWholeWords" />
</Style>
<!--Used for flyout messages-->
<Style x:Key="CustomFlyoutTextStyle" TargetType="TextBlock" BasedOn="{StaticResource BaseTextBlockStyle}">
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="Margin" Value="0,0,0,10"/>
<!-- Used for flyout messages -->
<Style x:Key="CustomFlyoutTextStyle"
BasedOn="{StaticResource BaseTextBlockStyle}"
TargetType="TextBlock">
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="Margin" Value="0,0,0,10" />
</Style>
<!--Number Box-->
<Style x:Key="NumberBoxSettingStyle" TargetType="muxc:NumberBox">
<Setter Property="SpinButtonPlacementMode" Value="Compact"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<!-- Number Box -->
<Style x:Key="NumberBoxSettingStyle"
TargetType="muxc:NumberBox">
<Setter Property="SpinButtonPlacementMode" Value="Compact" />
<Setter Property="HorizontalAlignment" Value="Left" />
</Style>
<!--Button-Related Styling-->
<Style x:Key="BaseButtonStyle" TargetType="Button" BasedOn="{StaticResource DefaultButtonStyle}">
<Setter Property="VerticalAlignment" Value="Center"/>
<!-- Button-Related Styling -->
<Style x:Key="BaseButtonStyle"
BasedOn="{StaticResource DefaultButtonStyle}"
TargetType="Button">
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
<Style x:Key="BrowseButtonStyle" TargetType="Button" BasedOn="{StaticResource BaseButtonStyle}">
<Setter Property="Margin" Value="10,0,0,0"/>
<Setter Property="Height" Value="33"/>
<Style x:Key="BrowseButtonStyle"
BasedOn="{StaticResource BaseButtonStyle}"
TargetType="Button">
<Setter Property="Margin" Value="10,0,0,0" />
<Setter Property="Height" Value="33" />
</Style>
<Style x:Key="DeleteButtonStyle" TargetType="Button" BasedOn="{StaticResource BaseButtonStyle}">
<Setter Property="Margin" Value="0,0,0,10"/>
<Style x:Key="DeleteButtonStyle"
BasedOn="{StaticResource BaseButtonStyle}"
TargetType="Button">
<Setter Property="Margin" Value="0,0,0,10" />
</Style>
<Style x:Key="SmallButtonStyle" TargetType="Button" BasedOn="{StaticResource BrowseButtonStyle}">
<Setter Property="Height" Value="33"/>
<Setter Property="Width" Value="33"/>
<Style x:Key="SmallButtonStyle"
BasedOn="{StaticResource BrowseButtonStyle}"
TargetType="Button">
<Setter Property="Height" Value="33" />
<Setter Property="Width" Value="33" />
</Style>
<Style x:Key="AccentBrowseButtonStyle" TargetType="Button" BasedOn="{StaticResource AccentButtonStyle}">
<Setter Property="Margin" Value="10,0,0,0"/>
<Setter Property="VerticalAlignment" Value="Bottom"/>
<Style x:Key="AccentBrowseButtonStyle"
BasedOn="{StaticResource AccentButtonStyle}"
TargetType="Button">
<Setter Property="Margin" Value="10,0,0,0" />
<Setter Property="VerticalAlignment" Value="Bottom" />
</Style>
<Style x:Key="AccentSmallButtonStyle" TargetType="Button" BasedOn="{StaticResource AccentButtonStyle}">
<Setter Property="Margin" Value="10,0,0,0"/>
<Setter Property="VerticalAlignment" Value="Bottom"/>
<Setter Property="Height" Value="33"/>
<Setter Property="Width" Value="33"/>
<Style x:Key="AccentSmallButtonStyle"
BasedOn="{StaticResource AccentButtonStyle}"
TargetType="Button">
<Setter Property="Margin" Value="10,0,0,0" />
<Setter Property="VerticalAlignment" Value="Bottom" />
<Setter Property="Height" Value="33" />
<Setter Property="Width" Value="33" />
</Style>
<Style x:Key="IconButtonTextBlockStyle" TargetType="TextBlock">
<Setter Property="Margin" Value="10,0,0,0"/>
<Style x:Key="IconButtonTextBlockStyle"
TargetType="TextBlock">
<Setter Property="Margin" Value="10,0,0,0" />
</Style>
<!--Slider-Related Styling-->
<Style x:Key="SliderValueLabelStyle" TargetType="TextBlock">
<Setter Property="Width" Value="35"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Margin" Value="5,0,0,0"/>
<!-- Slider-Related Styling -->
<Style x:Key="SliderValueLabelStyle"
TargetType="TextBlock">
<Setter Property="Width" Value="35" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="5,0,0,0" />
</Style>
<Style x:Key="CustomSliderControlGridStyle" TargetType="Grid">
<Setter Property="Width" Value="{StaticResource StandardBoxMinWidth}"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Style x:Key="CustomSliderControlGridStyle"
TargetType="Grid">
<Setter Property="Width" Value="{StaticResource StandardBoxMinWidth}" />
<Setter Property="HorizontalAlignment" Value="Left" />
</Style>
</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. -->
<Page
x:Class="Microsoft.Terminal.Settings.Editor.GlobalAppearance"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
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:muxc="using:Microsoft.UI.Xaml.Controls"
mc:Ignorable="d">
<!--
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
the MIT License. See LICENSE in the project root for license information.
-->
<Page x:Class="Microsoft.Terminal.Settings.Editor.GlobalAppearance"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.Terminal.Settings.Editor"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
mc:Ignorable="d">
<Page.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="CommonResources.xaml"/>
<ResourceDictionary Source="CommonResources.xaml" />
</ResourceDictionary.MergedDictionaries>
<DataTemplate x:DataType="local:EnumEntry" x:Key="EnumRadioButtonTemplate">
<RadioButton Content="{x:Bind EnumName, Mode=OneWay}"/>
<DataTemplate x:Key="EnumRadioButtonTemplate"
x:DataType="local:EnumEntry">
<RadioButton Content="{x:Bind EnumName, Mode=OneWay}" />
</DataTemplate>
<local:InvertedBooleanConverter x:Key="InvertedBooleanConverter"/>
<local:InvertedBooleanConverter x:Key="InvertedBooleanConverter" />
</ResourceDictionary>
</Page.Resources>
<ScrollViewer>
<StackPanel Style="{StaticResource SettingsStackStyle}">
<!--Theme-->
<!-- Theme -->
<local:SettingContainer x:Uid="Globals_Theme"
Margin="0">
<muxc:RadioButtons SelectedItem="{x:Bind CurrentTheme, Mode=TwoWay}"
<muxc:RadioButtons ItemTemplate="{StaticResource EnumRadioButtonTemplate}"
ItemsSource="{x:Bind ThemeList, Mode=OneWay}"
ItemTemplate="{StaticResource EnumRadioButtonTemplate}"/>
SelectedItem="{x:Bind CurrentTheme, Mode=TwoWay}" />
</local:SettingContainer>
<!--Always show tabs-->
<!-- Always show tabs -->
<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>
<!--Show Titlebar-->
<!-- Show Titlebar -->
<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>
<!--Show Title in Titlebar-->
<!-- Show Title in Titlebar -->
<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>
<!--Always on Top-->
<!-- Always on Top -->
<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>
<!--Tab Width Mode-->
<!-- Tab Width Mode -->
<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}"
ItemTemplate="{StaticResource EnumRadioButtonTemplate}"/>
SelectedItem="{x:Bind CurrentTabWidthMode, Mode=TwoWay}" />
</local:SettingContainer>
<!--Disable Animations-->
<!-- NOTE: the UID is "DisablePaneAnimationsReversed" not "DisablePaneAnimations". See GH#9124 for more details. -->
<!-- Disable Animations -->
<!-- NOTE: the UID is "DisablePaneAnimationsReversed" not "DisablePaneAnimations". See GH#9124 for more details. -->
<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>
</StackPanel>
</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. -->
<Page
x:Class="Microsoft.Terminal.Settings.Editor.Interaction"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
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:muxc="using:Microsoft.UI.Xaml.Controls"
mc:Ignorable="d">
<!--
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
the MIT License. See LICENSE in the project root for license information.
-->
<Page x:Class="Microsoft.Terminal.Settings.Editor.Interaction"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.Terminal.Settings.Editor"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
mc:Ignorable="d">
<Page.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="CommonResources.xaml"/>
<ResourceDictionary Source="CommonResources.xaml" />
</ResourceDictionary.MergedDictionaries>
<DataTemplate x:DataType="local:EnumEntry" x:Key="EnumRadioButtonTemplate">
<RadioButton Content="{x:Bind EnumName, Mode=OneWay}"/>
<DataTemplate x:Key="EnumRadioButtonTemplate"
x:DataType="local:EnumEntry">
<RadioButton Content="{x:Bind EnumName, Mode=OneWay}" />
</DataTemplate>
</ResourceDictionary>
</Page.Resources>
<ScrollViewer>
<StackPanel Style="{StaticResource SettingsStackStyle}">
<!--Copy On Select-->
<!-- Copy On Select -->
<local:SettingContainer x:Uid="Globals_CopyOnSelect"
Margin="0">
<ToggleSwitch IsOn="{x:Bind State.Globals.CopyOnSelect, Mode=TwoWay}"/>
</local:SettingContainer>
Margin="0">
<ToggleSwitch IsOn="{x:Bind State.Globals.CopyOnSelect, Mode=TwoWay}" />
</local:SettingContainer>
<!--Copy Format-->
<!-- Copy Format -->
<local:SettingContainer x:Uid="Globals_CopyFormat">
<muxc:RadioButtons ItemsSource="{x:Bind CopyFormatList, Mode=OneWay}"
SelectedItem="{x:Bind CurrentCopyFormat, Mode=TwoWay}"
ItemTemplate="{StaticResource EnumRadioButtonTemplate}"/>
<muxc:RadioButtons ItemTemplate="{StaticResource EnumRadioButtonTemplate}"
ItemsSource="{x:Bind CopyFormatList, Mode=OneWay}"
SelectedItem="{x:Bind CurrentCopyFormat, Mode=TwoWay}" />
</local:SettingContainer>
<!--Word Delimiters-->
<!-- Word Delimiters -->
<local:SettingContainer x:Uid="Globals_WordDelimiters">
<TextBox Text="{x:Bind State.Globals.WordDelimiters, Mode=TwoWay}"
Style="{StaticResource TextBoxSettingStyle}"/>
<TextBox Style="{StaticResource TextBoxSettingStyle}"
Text="{x:Bind State.Globals.WordDelimiters, Mode=TwoWay}" />
</local:SettingContainer>
<!--Snap On Resize-->
<!-- Snap On Resize -->
<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>
<!--Tab Switcher Mode-->
<!-- Tab Switcher Mode -->
<local:SettingContainer x:Uid="Globals_TabSwitcherMode">
<muxc:RadioButtons SelectedItem="{x:Bind CurrentTabSwitcherMode, Mode=TwoWay}"
<muxc:RadioButtons ItemTemplate="{StaticResource EnumRadioButtonTemplate}"
ItemsSource="{x:Bind TabSwitcherModeList}"
ItemTemplate="{StaticResource EnumRadioButtonTemplate}"/>
SelectedItem="{x:Bind CurrentTabSwitcherMode, Mode=TwoWay}" />
</local:SettingContainer>
<!-- Focus Follow Mouse Mode-->
<!-- Focus Follow Mouse Mode -->
<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>
</StackPanel>
</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. -->
<Page
x:Class="Microsoft.Terminal.Settings.Editor.Launch"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
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:muxc="using:Microsoft.UI.Xaml.Controls"
xmlns:SettingsModel="using:Microsoft.Terminal.Settings.Model"
mc:Ignorable="d">
<!--
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
the MIT License. See LICENSE in the project root for license information.
-->
<Page x:Class="Microsoft.Terminal.Settings.Editor.Launch"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:SettingsModel="using:Microsoft.Terminal.Settings.Model"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.Terminal.Settings.Editor"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
mc:Ignorable="d">
<Page.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="CommonResources.xaml"/>
<ResourceDictionary Source="CommonResources.xaml" />
</ResourceDictionary.MergedDictionaries>
<DataTemplate x:DataType="local:EnumEntry" x:Key="EnumRadioButtonTemplate">
<RadioButton Content="{x:Bind EnumName, Mode=OneWay}"/>
<DataTemplate x:Key="EnumRadioButtonTemplate"
x:DataType="local:EnumEntry">
<RadioButton Content="{x:Bind EnumName, Mode=OneWay}" />
</DataTemplate>
<SettingsModel:IconPathConverter x:Key="IconSourceConverter"/>
<Style x:Key="LaunchSizeNumberBoxStyle" TargetType="muxc:NumberBox" BasedOn="{StaticResource NumberBoxSettingStyle}">
<Setter Property="SmallChange" Value="1"/>
<Setter Property="LargeChange" Value="10"/>
<Setter Property="Minimum" Value="1"/>
<SettingsModel:IconPathConverter x:Key="IconSourceConverter" />
<Style x:Key="LaunchSizeNumberBoxStyle"
BasedOn="{StaticResource NumberBoxSettingStyle}"
TargetType="muxc:NumberBox">
<Setter Property="SmallChange" Value="1" />
<Setter Property="LargeChange" Value="10" />
<Setter Property="Minimum" Value="1" />
</Style>
</ResourceDictionary>
</Page.Resources>
@ -32,7 +36,7 @@ the MIT License. See LICENSE in the project root for license information. -->
<ScrollViewer>
<StackPanel>
<StackPanel Style="{StaticResource SettingsStackStyle}">
<!--Default Profile-->
<!-- Default Profile -->
<local:SettingContainer x:Uid="Globals_DefaultProfile"
Margin="0">
<ComboBox x:Name="DefaultProfile"
@ -41,25 +45,23 @@ the MIT License. See LICENSE in the project root for license information. -->
Style="{StaticResource ComboBoxSettingStyle}">
<ComboBox.ItemTemplate>
<DataTemplate x:DataType="SettingsModel:Profile">
<Grid HorizontalAlignment="Stretch" ColumnSpacing="8">
<Grid HorizontalAlignment="Stretch"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<!-- icon -->
<ColumnDefinition Width="16"/>
<!-- profile name -->
<ColumnDefinition Width="Auto"/>
<!-- icon -->
<ColumnDefinition Width="16" />
<!-- profile name -->
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<IconSourceElement
Grid.Column="0"
Width="16"
Height="16"
IconSource="{x:Bind Icon,
Mode=OneWay,
Converter={StaticResource IconSourceConverter}}"/>
<IconSourceElement Grid.Column="0"
Width="16"
Height="16"
IconSource="{x:Bind Icon, Mode=OneWay, Converter={StaticResource IconSourceConverter}}" />
<TextBlock Grid.Column="1"
Text="{x:Bind Name}"/>
Text="{x:Bind Name}" />
</Grid>
</DataTemplate>
@ -67,52 +69,51 @@ the MIT License. See LICENSE in the project root for license information. -->
</ComboBox>
</local:SettingContainer>
<!-- Default Terminal -->
<!-- Default Terminal -->
<local:SettingContainer x:Uid="Globals_DefaultTerminal">
<ComboBox x:Name="DefaultTerminal"
x:Load="False"
ItemsSource="{x:Bind DefaultTerminals, Mode=OneWay}"
SelectedItem="{x:Bind CurrentDefaultTerminal, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}">
</ComboBox>
Style="{StaticResource ComboBoxSettingStyle}" />
</local:SettingContainer>
<!--Start on User Login-->
<!-- Start on User Login -->
<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>
<!--Launch Mode-->
<!-- Launch Mode -->
<local:SettingContainer x:Uid="Globals_LaunchMode">
<muxc:RadioButtons SelectedItem="{x:Bind CurrentLaunchMode, Mode=TwoWay}"
<muxc:RadioButtons ItemTemplate="{StaticResource EnumRadioButtonTemplate}"
ItemsSource="{x:Bind LaunchModeList}"
ItemTemplate="{StaticResource EnumRadioButtonTemplate}"/>
SelectedItem="{x:Bind CurrentLaunchMode, Mode=TwoWay}" />
</local:SettingContainer>
<!--Launch Mode-->
<!-- Launch Mode -->
<local:SettingContainer x:Uid="Globals_WindowingBehavior">
<muxc:RadioButtons SelectedItem="{x:Bind CurrentWindowingBehavior, Mode=TwoWay}"
<muxc:RadioButtons ItemTemplate="{StaticResource EnumRadioButtonTemplate}"
ItemsSource="{x:Bind WindowingBehaviorList}"
ItemTemplate="{StaticResource EnumRadioButtonTemplate}"/>
SelectedItem="{x:Bind CurrentWindowingBehavior, Mode=TwoWay}" />
</local:SettingContainer>
</StackPanel>
<!--Launch Size-->
<!-- Launch Size -->
<StackPanel Style="{StaticResource SettingsStackStyle}">
<!--Header-->
<!-- Header -->
<TextBlock x:Uid="Globals_LaunchSize"
Style="{StaticResource SubtitleTextBlockStyle}"/>
Style="{StaticResource SubtitleTextBlockStyle}" />
<!--Columns-->
<!-- Columns -->
<local:SettingContainer x:Uid="Globals_InitialCols"
Margin="0">
<muxc:NumberBox Value="{x:Bind State.Settings.GlobalSettings.InitialCols, Mode=TwoWay}"
Style="{StaticResource LaunchSizeNumberBoxStyle}"/>
<muxc:NumberBox Style="{StaticResource LaunchSizeNumberBoxStyle}"
Value="{x:Bind State.Settings.GlobalSettings.InitialCols, Mode=TwoWay}" />
</local:SettingContainer>
<!--Rows-->
<!-- Rows -->
<local:SettingContainer x:Uid="Globals_InitialRows">
<muxc:NumberBox Value="{x:Bind State.Settings.GlobalSettings.InitialRows, Mode=TwoWay}"
Style="{StaticResource LaunchSizeNumberBoxStyle}"/>
<muxc:NumberBox Style="{StaticResource LaunchSizeNumberBoxStyle}"
Value="{x:Bind State.Settings.GlobalSettings.InitialRows, Mode=TwoWay}" />
</local:SettingContainer>
</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. -->
<Page
x:Class="Microsoft.Terminal.Settings.Editor.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
mc:Ignorable="d">
<!--
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
the MIT License. See LICENSE in the project root for license information.
-->
<Page x:Class="Microsoft.Terminal.Settings.Editor.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
mc:Ignorable="d">
<Page.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="CommonResources.xaml"/>
<ResourceDictionary Source="CommonResources.xaml" />
</ResourceDictionary.MergedDictionaries>
<AcrylicBrush x:Key="NavigationViewDefaultPaneBackground"
BackgroundSource="Backdrop"
TintColor="{ThemeResource SystemChromeMediumColor}"
TintOpacity="0.5"/>
TintOpacity="0.5" />
<AcrylicBrush x:Key="NavigationViewTopPaneBackground"
BackgroundSource="Backdrop"
TintColor="{ThemeResource SystemChromeMediumColor}"
TintOpacity="0.5"/>
TintOpacity="0.5" />
<AcrylicBrush x:Key="NavigationViewExpandedPaneBackground"
BackgroundSource="HostBackdrop"
TintColor="{ThemeResource SystemChromeMediumColor}"
TintOpacity="0.7"/>
TintOpacity="0.7" />
</ResourceDictionary>
</Page.Resources>
<muxc:NavigationView x:Name="SettingsNav"
IsSettingsVisible="False"
Header="{Binding ElementName=SettingsNav, Path=SelectedItem.Content, Mode=OneWay}"
Loaded="SettingsNav_Loaded"
ItemInvoked="SettingsNav_ItemInvoked"
IsBackButtonVisible="Collapsed"
IsSettingsVisible="False"
ItemInvoked="SettingsNav_ItemInvoked"
Loaded="SettingsNav_Loaded"
TabFocusNavigation="Cycle">
<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"
Tag="Launch_Nav">
<muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE7B5;"/>
<FontIcon Glyph="&#xE7B5;" />
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>
<muxc:NavigationViewItem x:Uid="Nav_Interaction"
Tag="Interaction_Nav">
<muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE7C9;"/>
<FontIcon Glyph="&#xE7C9;" />
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>
<muxc:NavigationViewItem x:Uid="Nav_Appearance"
Tag="GlobalAppearance_Nav">
<muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE771;"/>
<FontIcon Glyph="&#xE771;" />
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>
<muxc:NavigationViewItem x:Uid="Nav_ColorSchemes"
Tag="ColorSchemes_Nav">
<muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE790;"/>
<FontIcon Glyph="&#xE790;" />
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>
<muxc:NavigationViewItem x:Uid="Nav_Rendering"
Tag="Rendering_Nav" >
Tag="Rendering_Nav">
<muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE7F8;"/>
<FontIcon Glyph="&#xE7F8;" />
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>
<muxc:NavigationViewItem x:Uid="Nav_Actions"
Tag="Actions_Nav" >
Tag="Actions_Nav">
<muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE765;"/>
<FontIcon Glyph="&#xE765;" />
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>
<muxc:NavigationViewItemHeader x:Uid="Nav_Profiles"/>
<muxc:NavigationViewItemHeader x:Uid="Nav_Profiles" />
<muxc:NavigationViewItem x:Uid="Nav_ProfileDefaults"
x:Name="BaseLayerMenuItem"
<muxc:NavigationViewItem x:Name="BaseLayerMenuItem"
x:Uid="Nav_ProfileDefaults"
Tag="GlobalProfile_Nav">
<muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE81E;"/>
<FontIcon Glyph="&#xE81E;" />
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>
</muxc:NavigationView.MenuItems>
<muxc:NavigationView.PaneFooter>
<!--The OpenJson item needs both Tapped and KeyDown handler-->
<muxc:NavigationViewItem x:Uid="Nav_OpenJSON"
x:Name="OpenJsonNavItem"
Tapped="OpenJsonTapped"
KeyDown="OpenJsonKeyDown">
<!-- The OpenJson item needs both Tapped and KeyDown handler -->
<muxc:NavigationViewItem x:Name="OpenJsonNavItem"
x:Uid="Nav_OpenJSON"
KeyDown="OpenJsonKeyDown"
Tapped="OpenJsonTapped">
<muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE713;"/>
<FontIcon Glyph="&#xE713;" />
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>
</muxc:NavigationView.PaneFooter>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Frame x:Name="contentFrame"
Grid.Row="0"></Frame>
<Grid Height="100" Grid.Row="1"
Grid.Row="0" />
<Grid Grid.Row="1"
Height="100"
BorderBrush="{ThemeResource SystemBaseLowColor}"
BorderThickness="0,1,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock x:Uid="Settings_UnsavedSettingsWarning"
Visibility="Collapsed"
Foreground="Goldenrod"
VerticalAlignment="Center"
Margin="30,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Foreground="Goldenrod"
TextAlignment="Left"
Margin="30,0,0,0"/>
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Right" Orientation="Horizontal" Margin="0,0,30,0">
<Button x:Uid="Settings_ResetSettingsButton"
x:Name="ResetButton"
Click="ResetButton_Click"/>
<Button x:Uid="Settings_SaveSettingsButton"
x:Name="SaveButton"
Style="{StaticResource AccentButtonStyle}"
Visibility="Collapsed" />
<StackPanel Margin="0,0,30,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Orientation="Horizontal">
<Button x:Name="ResetButton"
x:Uid="Settings_ResetSettingsButton"
Click="ResetButton_Click" />
<Button x:Name="SaveButton"
x:Uid="Settings_SaveSettingsButton"
Margin="10,0,0,0"
Click="SaveButton_Click"/>
Click="SaveButton_Click"
Style="{StaticResource AccentButtonStyle}" />
</StackPanel>
</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. -->
<Page
x:Class="Microsoft.Terminal.Settings.Editor.Rendering"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
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"
mc:Ignorable="d">
<!--
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
the MIT License. See LICENSE in the project root for license information.
-->
<Page x:Class="Microsoft.Terminal.Settings.Editor.Rendering"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.Terminal.Settings.Editor"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Page.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="CommonResources.xaml"/>
<ResourceDictionary Source="CommonResources.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Page.Resources>
<ScrollViewer>
<StackPanel Style="{StaticResource SettingsStackStyle}">
<TextBlock x:Uid="Globals_RenderingDisclaimer"
Style="{StaticResource DisclaimerStyle}"/>
Style="{StaticResource DisclaimerStyle}" />
<!--Force Full Repaint-->
<!-- Force Full Repaint -->
<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>
<!--Software Rendering-->
<!-- Software Rendering -->
<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>
</StackPanel>
</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. -->
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
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"
mc:Ignorable="d">
<!--
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
the MIT License. See LICENSE in the project root for license information.
-->
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.Terminal.Settings.Editor"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Style x:Key="SettingContainerHeaderStyle" TargetType="StackPanel">
<Setter Property="Orientation" Value="Horizontal"/>
<Setter Property="Margin" Value="0,0,0,4"/>
<Style x:Key="SettingContainerHeaderStyle"
TargetType="StackPanel">
<Setter Property="Orientation" Value="Horizontal" />
<Setter Property="Margin" Value="0,0,0,4" />
</Style>
<Style x:Key="SettingContainerResetButtonStyle" TargetType="Button">
<Setter Property="Margin" Value="5,0,0,0"/>
<Setter Property="Height" Value="19"/>
<Setter Property="Width" Value="19"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="Background" Value="Transparent"/>
<Style x:Key="SettingContainerResetButtonStyle"
TargetType="Button">
<Setter Property="Margin" Value="5,0,0,0" />
<Setter Property="Height" Value="19" />
<Setter Property="Width" Value="19" />
<Setter Property="Padding" Value="0" />
<Setter Property="Background" Value="Transparent" />
</Style>
<Style x:Key="SettingContainerFontIconStyle" TargetType="FontIcon">
<Setter Property="Foreground" Value="{StaticResource SystemAccentColor}"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontFamily" Value="Segoe MDL2 Assets"/>
<Style x:Key="SettingContainerFontIconStyle"
TargetType="FontIcon">
<Setter Property="Foreground" Value="{StaticResource SystemAccentColor}" />
<Setter Property="FontSize" Value="14" />
<Setter Property="FontFamily" Value="Segoe MDL2 Assets" />
</Style>
<Style TargetType="local:SettingContainer">
<Setter Property="Margin" Value="0,24,0,0"/>
<Setter Property="IsTabStop" Value="False"/>
<Setter Property="Margin" Value="0,24,0,0" />
<Setter Property="IsTabStop" Value="False" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:SettingContainer">
<StackPanel>
<!--Header space-->
<!-- Header space -->
<StackPanel Style="{StaticResource SettingContainerHeaderStyle}">
<TextBlock Text="{TemplateBinding Header}"/>
<TextBlock Text="{TemplateBinding Header}" />
<Button x:Name="ResetButton"
Style="{StaticResource SettingContainerResetButtonStyle}">
<FontIcon Glyph="&#xE845;"
Style="{StaticResource SettingContainerFontIconStyle}"/>
Style="{StaticResource SettingContainerFontIconStyle}" />
</Button>
</StackPanel>
<!--This is where the actual setting control will go-->
<ContentPresenter Content="{TemplateBinding Content}"/>
<!-- This is where the actual setting control will go -->
<ContentPresenter Content="{TemplateBinding Content}" />
</StackPanel>
</ControlTemplate>
</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: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"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Name="terminalUserControl"
d:DesignHeight="450"
d:DesignWidth="800"
Focusable="True"
x:Name="terminalUserControl">
mc:Ignorable="d">
<Grid x:Name="terminalGrid">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<local:TerminalContainer x:Name="termContainer"/>
<ScrollBar x:Name="scrollbar" Scroll="Scrollbar_Scroll" SmallChange="1" Grid.Column="1" />
<local:TerminalContainer x:Name="termContainer" />
<ScrollBar x:Name="scrollbar"
Grid.Column="1"
Scroll="Scrollbar_Scroll"
SmallChange="1" />
</Grid>
</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:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WpfTerminalTestNetCore"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
<Application.Resources />
</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:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
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"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
Title="MainWindow"
Width="800"
Height="450"
mc:Ignorable="d">
<Grid>
<term:TerminalControl x:Name="Terminal" Focusable="true" />
<term:TerminalControl x:Name="Terminal"
Focusable="true" />
</Grid>
</Window>

View File

@ -92,7 +92,7 @@ function Set-MsbuildDevEnvironment
Write-Verbose 'Setting up environment variables'
Enter-VsDevShell -VsInstallPath $vspath -SkipAutomaticLocation `
-devCmdArguments "-arch=$arch" | Out-Null
Set-Item -Force -path "Env:\Platform" -Value $arch
Write-Host "Dev environment variables set" -ForegroundColor Green
@ -364,8 +364,56 @@ function Invoke-ClangFormat {
}
#.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() {
[CmdletBinding()]
Param (
[parameter(Mandatory=$false)]
[switch]$IgnoreXaml
)
$root = Find-OpenConsoleRoot
& "$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*"
@ -373,6 +421,13 @@ function Invoke-CodeFormat() {
Get-ChildItem -Recurse "$root\src" -Include *.cpp, *.hpp, *.h |
Where FullName -NotLike "*Generated Files*" |
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.
## 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
`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"