Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update TextBox and related controls #3933

Merged
merged 5 commits into from
Jan 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions dev/AutoSuggestBox/AutoSuggestBox_themeresources.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
</ResourceDictionary.ThemeDictionaries>

<Thickness x:Key="AutoSuggestBoxTopHeaderMargin">0,0,0,4</Thickness>
<Thickness x:Key="AutoSuggestBoxInnerButtonMargin">0,4,0,4</Thickness>
<x:Double x:Key="AutoSuggestBoxRightButtonMargin">4</x:Double>

<Style TargetType="TextBox" x:Key="AutoSuggestBoxTextBoxStyle">
<Setter Property="MinWidth" Value="{ThemeResource TextControlThemeMinWidth}" />
Expand Down Expand Up @@ -60,6 +62,7 @@
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid x:Name="ButtonLayoutGrid"
Margin="{ThemeResource AutoSuggestBoxInnerButtonMargin}"
BorderBrush="{ThemeResource TextControlButtonBorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{ThemeResource TextControlButtonBackground}"
Expand Down Expand Up @@ -112,6 +115,7 @@
VerticalAlignment="Center"
HorizontalAlignment="Center"
FontStyle="Normal"
FontSize="12"
Text="&#xE10A;"
FontFamily="{ThemeResource SymbolThemeFontFamily}"
AutomationProperties.AccessibilityView="Raw" />
Expand All @@ -135,6 +139,7 @@
ContentTemplate="{TemplateBinding ContentTemplate}"
ContentTransitions="{TemplateBinding ContentTransitions}"
FontSize="{ThemeResource AutoSuggestBoxIconFontSize}"
Margin="{ThemeResource AutoSuggestBoxInnerButtonMargin}"
Padding="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Expand Down Expand Up @@ -279,6 +284,7 @@
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="{ThemeResource AutoSuggestBoxRightButtonMargin}" />
</Grid.ColumnDefinitions>

<Grid.RowDefinitions>
Expand All @@ -291,7 +297,7 @@
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Grid.ColumnSpan="3"
Grid.ColumnSpan="4"
Grid.RowSpan="1"
contract7Present:CornerRadius="{TemplateBinding CornerRadius}"
contract7NotPresent:CornerRadius="{ThemeResource ControlCornerRadius}" />
Expand All @@ -301,7 +307,7 @@
Grid.Row="0"
Foreground="{ThemeResource TextControlHeaderForeground}"
Margin="{ThemeResource AutoSuggestBoxTopHeaderMargin}"
Grid.ColumnSpan="3"
Grid.ColumnSpan="4"
Content="{TemplateBinding Header}"
ContentTemplate="{TemplateBinding HeaderTemplate}"
FontWeight="Normal"
Expand All @@ -328,36 +334,37 @@
Margin="{TemplateBinding BorderThickness}"
Padding="{TemplateBinding Padding}"
IsTabStop="False"
Grid.ColumnSpan="3"
Grid.ColumnSpan="4"
Content="{TemplateBinding PlaceholderText}"
IsHitTestVisible="False" />
<Button x:Name="DeleteButton"
Grid.Row="1"
Style="{StaticResource DeleteButtonStyle}"
BorderThickness="{TemplateBinding BorderThickness}"
contract7Present:CornerRadius="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=CornerRadius, Converter={StaticResource RightCornerRadiusFilterConverter}}"
contract7Present:CornerRadius="{TemplateBinding CornerRadius}"
Padding="{ThemeResource HelperButtonThemePadding}"
IsTabStop="False"
Grid.Column="1"
Visibility="Collapsed"
FontSize="{TemplateBinding FontSize}"
MinWidth="34"
Width="30"
AutomationProperties.AccessibilityView="Raw"
VerticalAlignment="Stretch" />
<Button x:Name="QueryButton"
Grid.Row="1"
contract7Present:CornerRadius="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=CornerRadius, Converter={StaticResource RightCornerRadiusFilterConverter}}"
contract7Present:CornerRadius="{TemplateBinding CornerRadius}"
Style="{StaticResource QueryButtonStyle}"
BorderThickness="{TemplateBinding BorderThickness}"
Padding="{ThemeResource HelperButtonThemePadding}"
IsTabStop="False"
Grid.Column="2"
FontSize="{TemplateBinding FontSize}"
MinWidth="34"
Width="{TemplateBinding Height}"
Width="30"
VerticalAlignment="Stretch"
AutomationProperties.AccessibilityView="Raw"/>
<contract7Present:ContentPresenter x:Name="DescriptionPresenter"
Grid.Row="2"
Grid.ColumnSpan="3"
Grid.ColumnSpan="4"
Content="{TemplateBinding Description}"
x:Load="False"
Foreground="{ThemeResource SystemControlDescriptionTextForegroundBrush}"
Expand Down
11 changes: 5 additions & 6 deletions dev/CommonStyles/Common_themeresources.xaml
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@
<SolidColorBrush x:Key="ApplicationPageBackgroundThemeBrush" Color="{StaticResource SolidBackgroundFillColorBase}" />

<StaticResource x:Key="DefaultTextForegroundThemeBrush" ResourceKey="TextFillColorPrimaryBrush" />
<StaticResource x:Key="DefaultApplicationBackgroundThemeBrush" ResourceKey="SolidBackgroundFillColorTertiaryBrush" />
<StaticResource x:Key="ApplicationPageBackgroundThemeBrush" ResourceKey="SolidBackgroundFillColorTertiaryBrush" />

<!-- Elevation border brushes-->

Expand Down Expand Up @@ -252,7 +252,7 @@
<SolidColorBrush x:Key="SystemControlHighlightListAccentMediumLowBrush" Color="{ThemeResource SystemAccentColor}" Opacity="0.75" />
<x:Boolean x:Key="UseSystemFocusVisuals">True</x:Boolean>
<Thickness x:Key="TextControlBorderThemeThickness">1</Thickness>
<Thickness x:Key="TextControlBorderThemeThicknessFocused">2</Thickness>
<Thickness x:Key="TextControlBorderThemeThicknessFocused">1,1,1,2</Thickness>
<Thickness x:Key="TextControlThemePadding">10,6,6,5</Thickness>
</ResourceDictionary>

Expand Down Expand Up @@ -463,8 +463,7 @@
<SolidColorBrush x:Key="ApplicationPageBackgroundThemeBrush" Color="{StaticResource SolidBackgroundFillColorBase}" />

<StaticResource x:Key="DefaultTextForegroundThemeBrush" ResourceKey="TextFillColorPrimaryBrush" />
<StaticResource x:Key="DefaultApplicationBackgroundThemeBrush" ResourceKey="SolidBackgroundFillColorTertiaryBrush" />

<StaticResource x:Key="ApplicationPageBackgroundThemeBrush" ResourceKey="SolidBackgroundFillColorTertiaryBrush" />

<!-- Elevation border brushes-->

Expand Down Expand Up @@ -502,7 +501,7 @@
<SolidColorBrush x:Key="SystemControlHighlightListAccentMediumLowBrush" Color="{ThemeResource SystemAccentColor}" Opacity="0.75" />
<x:Boolean x:Key="UseSystemFocusVisuals">True</x:Boolean>
<Thickness x:Key="TextControlBorderThemeThickness">1</Thickness>
<Thickness x:Key="TextControlBorderThemeThicknessFocused">2</Thickness>
<Thickness x:Key="TextControlBorderThemeThicknessFocused">1,1,1,2</Thickness>
<Thickness x:Key="TextControlThemePadding">10,6,6,5</Thickness>
</ResourceDictionary>

Expand Down Expand Up @@ -610,7 +609,7 @@
<SolidColorBrush x:Key="SystemFillColorCriticalBackgroundBrush" Color="{ThemeResource SystemColorWindowColor}" />

<StaticResource x:Key="DefaultTextForegroundThemeBrush" ResourceKey="TextFillColorPrimaryBrush" />
<StaticResource x:Key="DefaultApplicationBackgroundThemeBrush" ResourceKey="SolidBackgroundFillColorTertiaryBrush" />
<StaticResource x:Key="ApplicationPageBackgroundThemeBrush" ResourceKey="SolidBackgroundFillColorTertiaryBrush" />

<!-- Elevation border brushes-->

Expand Down
5 changes: 3 additions & 2 deletions dev/CommonStyles/PasswordBox_themeresources.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Grid x:Name="ButtonLayoutGrid"
Margin="{ThemeResource TextBoxInnerButtonMargin}"
BorderBrush="{ThemeResource TextControlButtonBorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{ThemeResource TextControlButtonBackground}"
Expand Down Expand Up @@ -280,13 +281,13 @@
Grid.Column="1"
Style="{StaticResource RevealButtonStyle}"
BorderThickness="{TemplateBinding BorderThickness}"
contract7Present:CornerRadius="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=CornerRadius, Converter={StaticResource RightCornerRadiusFilterConverter}}"
contract7Present:CornerRadius="{TemplateBinding CornerRadius}"
Padding="{ThemeResource HelperButtonThemePadding}"
IsTabStop="False"
Visibility="Collapsed"
FontSize="{TemplateBinding FontSize}"
VerticalAlignment="Stretch"
MinWidth="34" />
Width="30" />
<contract7Present:ContentPresenter x:Name="DescriptionPresenter"
Grid.Row="2"
Grid.Column="0"
Expand Down
8 changes: 8 additions & 0 deletions dev/CommonStyles/TestUI/CommonStyles_TestUI.projitems
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
<Generator>MSBuild:Compile</Generator>
<IncludeInWindowsAppx>false</IncludeInWindowsAppx>
</Page>
<Page Include="$(MSBuildThisFileDirectory)TextBoxPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<IncludeInWindowsAppx>false</IncludeInWindowsAppx>
</Page>
<Page Include="$(MSBuildThisFileDirectory)VisualStatesPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand All @@ -41,6 +46,9 @@
<Compile Include="$(MSBuildThisFileDirectory)CornerRadiusPage.xaml.cs">
<DependentUpon>CornerRadiusPage.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)TextBoxPage.xaml.cs">
<DependentUpon>TextBoxPage.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)VisualStatesPage.xaml.cs">
<DependentUpon>VisualStatesPage.xaml</DependentUpon>
</Compile>
Expand Down
66 changes: 66 additions & 0 deletions dev/CommonStyles/TestUI/TextBoxPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE in the project root for license information. -->
<local:TestPage
x:Class="MUXControlsTestApp.TextBoxPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:MUXControlsTestApp"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="using:Microsoft.UI.Xaml.Controls"
xmlns:primitives="using:Microsoft.UI.Xaml.Controls.Primitives"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
xmlns:contract5Present="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 5)"
xmlns:contract7Present="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract,7)"
xmlns:muxContract7Present="using:Microsoft.UI.Xaml.Controls?IsApiContractPresent(Windows.Foundation.UniversalApiContract,7)">

<StackPanel Margin="12">
<CheckBox x:Name="EnabledCheckBox" Content="Boxen Enabled" IsChecked="True"/>

<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120"/>
<ColumnDefinition Width="200"/>
<ColumnDefinition Width="120"/>
<ColumnDefinition Width="200"/>
<ColumnDefinition Width="120"/>
</Grid.ColumnDefinitions>

<StackPanel Orientation="Vertical" contract5Present:Spacing="12" Margin="0,0,12,0">
<TextBlock Text="TextBox"/>

<TextBox Header="Normal" Text="Text" IsEnabled="{x:Bind EnabledCheckBox.IsChecked.Value, Mode=OneWay}" />
<TextBox PlaceholderText="Placeholder" Header="Placeholder" IsEnabled="{x:Bind EnabledCheckBox.IsChecked.Value, Mode=OneWay}" />
</StackPanel>

<StackPanel Orientation="Vertical" contract5Present:Spacing="12" Grid.Column="1" Margin="0,0,12,0">
<TextBlock Text="RichEditBox"/>

<RichEditBox Header="Normal" IsEnabled="{x:Bind EnabledCheckBox.IsChecked.Value, Mode=OneWay}" />
<RichEditBox Header="Placeholder" PlaceholderText="Placeholder" IsEnabled="{x:Bind EnabledCheckBox.IsChecked.Value, Mode=OneWay}" />
</StackPanel>

<StackPanel Orientation="Vertical" contract5Present:Spacing="12" Grid.Column="2" Margin="0,0,12,0">
<TextBlock Text="PasswordBox"/>

<PasswordBox Header="Normal" IsEnabled="{x:Bind EnabledCheckBox.IsChecked.Value, Mode=OneWay}" />
<PasswordBox PlaceholderText="Placeholder" Header="Placeholder" IsEnabled="{x:Bind EnabledCheckBox.IsChecked.Value, Mode=OneWay}" />
</StackPanel>

<StackPanel Orientation="Vertical" contract5Present:Spacing="12" Grid.Column="3" Margin="0,0,12,0">
<TextBlock Text="AutoSuggest"/>

<AutoSuggestBox Header="Normal" Text="Text" QueryIcon="Find" IsEnabled="{x:Bind EnabledCheckBox.IsChecked.Value, Mode=OneWay}" />
<AutoSuggestBox Header="Placeholder" PlaceholderText="Placeholder" IsEnabled="{x:Bind EnabledCheckBox.IsChecked.Value, Mode=OneWay}"/>
</StackPanel>

<StackPanel Orientation="Vertical" contract5Present:Spacing="12" Grid.Column="4" Margin="0,0,12,0">
<TextBlock Text="NumberBox"/>

<controls:NumberBox Header="Normal" Text="123" IsEnabled="{x:Bind EnabledCheckBox.IsChecked.Value, Mode=OneWay}" />
<controls:NumberBox Header="Placeholder" PlaceholderText="Placeholder" IsEnabled="{x:Bind EnabledCheckBox.IsChecked.Value, Mode=OneWay}"/>
</StackPanel>
</Grid>
</StackPanel>

</local:TestPage>
18 changes: 18 additions & 0 deletions dev/CommonStyles/TestUI/TextBoxPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System.Collections.ObjectModel;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;

namespace MUXControlsTestApp
{
[TopLevelTestPage(Name = "TextBox")]
public sealed partial class TextBoxPage : TestPage
{
public TextBoxPage()
{
this.InitializeComponent();
}

}
}
2 changes: 1 addition & 1 deletion dev/CommonStyles/TestUI/VisualStatesPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:util="using:MUXControlsTestApp.Utilities"
mc:Ignorable="d"
Background="{ThemeResource DefaultApplicationBackgroundThemeBrush}">
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

<Page.Resources>
<!-- Compact this a bit -->
Expand Down
3 changes: 3 additions & 0 deletions dev/CommonStyles/TestUI/VisualStatesPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ public sealed partial class VisualStatesPage : Page

new ControlStateViewer(typeof(Slider),
new List<string>(){ "Normal", "PointerOver", "Pressed", "Disabled" }),

new ControlStateViewer(typeof(TextBox),
new List<string>(){ "Normal", "PointerOver", "Focused", "Disabled" }),
};

public VisualStatesPage()
Expand Down
Loading