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

Add new TextBlock styles #4108

Merged
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
12 changes: 11 additions & 1 deletion dev/CommonStyles/CommonStyles.vcxitems
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,23 @@
<Page Include="$(MSBuildThisFileDirectory)TextBox_themeresources.xaml">
<UseVisualStyle>Latest</UseVisualStyle>
<Version>RS1</Version>
<Type>ThemeResources</Type>
<Type>ThemeResources</Type>
</Page>
<Page Include="$(MSBuildThisFileDirectory)TextBox_themeresources_v2.5.xaml">
<UseVisualStyle>V2dot5</UseVisualStyle>
<Version>RS1</Version>
<Type>ThemeResources</Type>
</Page>
<Page Include="$(MSBuildThisFileDirectory)TextBlock_themeresources.xaml">
<UseVisualStyle>Latest</UseVisualStyle>
marcelwgn marked this conversation as resolved.
Show resolved Hide resolved
<Version>RS1</Version>
<Type>ThemeResources</Type>
</Page>
<Page Include="$(MSBuildThisFileDirectory)TextBlock_themeresources_v2.5.xaml">
<UseVisualStyle>V2dot5</UseVisualStyle>
<Version>RS1</Version>
<Type>ThemeResources</Type>
</Page>
<Page Include="$(MSBuildThisFileDirectory)FlyoutPresenter_themeresources.xaml">
<UseVisualStyle>Latest</UseVisualStyle>
<Version>RS1</Version>
Expand Down
6 changes: 3 additions & 3 deletions dev/CommonStyles/TestUI/CommonStyles_TestUI.projitems
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<Generator>MSBuild:Compile</Generator>
<IncludeInWindowsAppx>false</IncludeInWindowsAppx>
</Page>
<Page Include="$(MSBuildThisFileDirectory)TextBoxPage.xaml">
<Page Include="$(MSBuildThisFileDirectory)TextControlsPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<IncludeInWindowsAppx>false</IncludeInWindowsAppx>
Expand All @@ -54,8 +54,8 @@
<Compile Include="$(MSBuildThisFileDirectory)CornerRadiusPage.xaml.cs">
<DependentUpon>CornerRadiusPage.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)TextBoxPage.xaml.cs">
<DependentUpon>TextBoxPage.xaml</DependentUpon>
<Compile Include="$(MSBuildThisFileDirectory)TextControlsPage.xaml.cs">
<DependentUpon>TextControlsPage.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)VisualStatesPage.xaml.cs">
<DependentUpon>VisualStatesPage.xaml</DependentUpon>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- 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"
x:Class="MUXControlsTestApp.TextControlsPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:MUXControlsTestApp"
Expand All @@ -15,7 +15,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"/>
<CheckBox x:Name="EnabledCheckBox" Content="Boxes Enabled" IsChecked="True"/>

<Grid>
<Grid.ColumnDefinitions>
Expand Down Expand Up @@ -61,6 +61,16 @@
<controls:NumberBox Header="Placeholder" PlaceholderText="Placeholder" IsEnabled="{x:Bind EnabledCheckBox.IsChecked.Value, Mode=OneWay}"/>
</StackPanel>
</Grid>

<TextBlock Text="TextBlock styles collection" FontSize="24" TextDecorations="Underline"/>
<TextBlock Style="{StaticResource BaseTextBlockStyle}" Text="BaseTextBlockStyle"/>
<TextBlock Style="{StaticResource CaptionTextBlockStyle}" Text="CaptionTextBlockStyle"/>
<TextBlock Style="{StaticResource BodyTextBlockStyle}" Text="BodyTextBlockStyle"/>
<TextBlock Style="{StaticResource BodyStrongTextBlockStyle}" Text="BodyStrongTextBlockStyle"/>
<TextBlock Style="{StaticResource SubtitleTextBlockStyle}" Text="SubtitleTextBlockStyle"/>
<TextBlock Style="{StaticResource TitleTextBlockStyle}" Text="TitleTextBlockStyle"/>
<TextBlock Style="{StaticResource TitleLargeTextBlockStyle}" Text="TitleLargeTextBlockStyle"/>
<TextBlock Style="{StaticResource DisplayTextBlockStyle}" Text="DisplayTextBlockStyle"/>
</StackPanel>

</local:TestPage>
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

namespace MUXControlsTestApp
{
[TopLevelTestPage(Name = "TextBox")]
public sealed partial class TextBoxPage : TestPage
[TopLevelTestPage(Name = "TextControls")]
public sealed partial class TextControlsPage : TestPage
{
public TextBoxPage()
public TextControlsPage()
{
this.InitializeComponent();
}
Expand Down
56 changes: 56 additions & 0 deletions dev/CommonStyles/TextBlock_themeresources.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +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">

<x:Double x:Key="CaptionTextBlockFontSize">12</x:Double>
<x:Double x:Key="BodyTextBlockFontSize">14</x:Double>
<x:Double x:Key="SubtitleTextBlockFontSize">20</x:Double>
<x:Double x:Key="TitleTextBlockFontSize">28</x:Double>
<x:Double x:Key="TitleLargeTextBlockFontSize">40</x:Double>
<x:Double x:Key="DisplayTextBlockFontSize">68</x:Double>

<Style x:Key="BaseTextBlockStyle" TargetType="TextBlock">
licanhua marked this conversation as resolved.
Show resolved Hide resolved
<Setter Property="FontFamily" Value="XamlAutoFontFamily" />
<Setter Property="TextTrimming" Value="CharacterEllipsis" />
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="LineStackingStrategy" Value="MaxHeight" />
<Setter Property="TextLineBounds" Value="Full" />
<Setter Property="OpticalMarginAlignment" Value="TrimSideBearings" />
</Style>

<Style x:Key="CaptionTextBlockStyle" TargetType="TextBlock" BasedOn="{StaticResource BaseTextBlockStyle}">
<Setter Property="FontSize" Value="{StaticResource CaptionTextBlockFontSize}" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="OpticalMarginAlignment" Value="None" />
</Style>

<Style x:Key="BodyTextBlockStyle" TargetType="TextBlock" BasedOn="{StaticResource BaseTextBlockStyle}">
<Setter Property="FontSize" Value="{StaticResource BodyTextBlockFontSize}" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="OpticalMarginAlignment" Value="None" />
</Style>

<Style x:Key="BodyStrongTextBlockStyle" TargetType="TextBlock" BasedOn="{StaticResource BodyTextBlockStyle}">
<Setter Property="FontWeight" Value="SemiBold" />
</Style>

<Style x:Key="SubtitleTextBlockStyle" TargetType="TextBlock" BasedOn="{StaticResource BaseTextBlockStyle}">
<Setter Property="FontSize" Value="{StaticResource SubtitleTextBlockFontSize}" />
<Setter Property="FontWeight" Value="SemiBold" />
</Style>

<Style x:Key="TitleTextBlockStyle" TargetType="TextBlock" BasedOn="{StaticResource BaseTextBlockStyle}">
<Setter Property="FontSize" Value="{StaticResource TitleTextBlockFontSize}" />
<Setter Property="FontWeight" Value="SemiBold" />
</Style>

<Style x:Key="TitleLargeTextBlockStyle" TargetType="TextBlock" BasedOn="{StaticResource BaseTextBlockStyle}">
<Setter Property="FontSize" Value="{StaticResource TitleLargeTextBlockFontSize}" />
<Setter Property="FontWeight" Value="SemiBold" />
</Style>

<Style x:Key="DisplayTextBlockStyle" TargetType="TextBlock" BasedOn="{StaticResource BaseTextBlockStyle}">
<Setter Property="FontSize" Value="{StaticResource DisplayTextBlockFontSize}" />
<Setter Property="FontWeight" Value="SemiBold" />
</Style>
</ResourceDictionary>
26 changes: 26 additions & 0 deletions dev/CommonStyles/TextBlock_themeresources_v2.5.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!-- 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"
marcelwgn marked this conversation as resolved.
Show resolved Hide resolved
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

<x:Double x:Key="BodyStrongTextBlockFontSize">14</x:Double>
<x:Double x:Key="TitleLargeTextBlockFontSize">40</x:Double>
<x:Double x:Key="DisplayTextBlockFontSize">68</x:Double>

<Style x:Key="BodyStrongTextBlockStyle" TargetType="TextBlock" BasedOn="{StaticResource BodyTextBlockStyle}">
<Setter Property="FontSize" Value="{StaticResource BodyStrongTextBlockFontSize}" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="OpticalMarginAlignment" Value="None" />
</Style>

<Style x:Key="TitleLargeTextBlockStyle" TargetType="TextBlock" BasedOn="{StaticResource BaseTextBlockStyle}">
<Setter Property="FontSize" Value="{StaticResource TitleLargeTextBlockFontSize}" />
<Setter Property="FontWeight" Value="SemiBold" />
</Style>

<Style x:Key="DisplayTextBlockStyle" TargetType="TextBlock" BasedOn="{StaticResource BaseTextBlockStyle}">
<Setter Property="FontSize" Value="{StaticResource DisplayTextBlockFontSize}" />
<Setter Property="FontWeight" Value="SemiBold" />
</Style>
</ResourceDictionary>


Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@
FocusVisualPrimaryThickness=2,2,2,2
FocusVisualPrimaryBrush=#FF000000
Visibility=Visible
RenderSize=30,20
RenderSize=32,22
[Windows.UI.Xaml.Controls.Grid]
Padding=0,0,0,0
CornerRadius=0,0,0,0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@
FocusVisualPrimaryThickness=2,2,2,2
FocusVisualPrimaryBrush=#FF000000
Visibility=Visible
RenderSize=30,20
RenderSize=32,22
[Windows.UI.Xaml.Controls.Grid]
Padding=0,0,0,0
CornerRadius=0,0,0,0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@
FocusVisualPrimaryThickness=2,2,2,2
FocusVisualPrimaryBrush=#FF000000
Visibility=Visible
RenderSize=30,20
RenderSize=32,22
[Windows.UI.Xaml.Controls.Grid]
Padding=0,0,0,0
CornerRadius=0,0,0,0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@
FocusVisualPrimaryThickness=2,2,2,2
FocusVisualPrimaryBrush=#FF000000
Visibility=Visible
RenderSize=28,19
RenderSize=32,22
[Windows.UI.Xaml.Controls.Grid]
Padding=0,0,0,0
CornerRadius=0,0,0,0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@
FocusVisualPrimaryThickness=2,2,2,2
FocusVisualPrimaryBrush=#FF000000
Visibility=Visible
RenderSize=28,19
RenderSize=32,22
[Windows.UI.Xaml.Controls.Grid]
Padding=0,0,0,0
CornerRadius=0,0,0,0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@
FocusVisualPrimaryThickness=2,2,2,2
FocusVisualPrimaryBrush=#FF000000
Visibility=Collapsed
RenderSize=30,20
RenderSize=32,22
[Windows.UI.Xaml.Controls.Grid]
Padding=0,0,0,0
CornerRadius=0,0,0,0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@
FocusVisualPrimaryThickness=2,2,2,2
FocusVisualPrimaryBrush=#FF000000
Visibility=Collapsed
RenderSize=30,20
RenderSize=22,22
[Windows.UI.Xaml.Controls.Grid]
Padding=0,0,0,0
CornerRadius=0,0,0,0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@
FocusVisualPrimaryThickness=2,2,2,2
FocusVisualPrimaryBrush=#FF000000
Visibility=Collapsed
RenderSize=30,20
RenderSize=22,22
[Windows.UI.Xaml.Controls.Grid]
Padding=0,0,0,0
CornerRadius=0,0,0,0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@
FocusVisualPrimaryThickness=2,2,2,2
FocusVisualPrimaryBrush=#FF000000
Visibility=Collapsed
RenderSize=28,19
RenderSize=22,22
[Windows.UI.Xaml.Controls.Grid]
Padding=0,0,0,0
CornerRadius=0,0,0,0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@
FocusVisualPrimaryThickness=2,2,2,2
FocusVisualPrimaryBrush=#FF000000
Visibility=Collapsed
RenderSize=28,19
RenderSize=22,22
[Windows.UI.Xaml.Controls.Grid]
Padding=0,0,0,0
CornerRadius=0,0,0,0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@
FocusVisualPrimaryThickness=2,2,2,2
FocusVisualPrimaryBrush=#FF000000
Visibility=Visible
RenderSize=30,20
RenderSize=22,22
[Windows.UI.Xaml.Controls.Grid]
Padding=0,0,0,0
CornerRadius=0,0,0,0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@
FocusVisualPrimaryThickness=2,2,2,2
FocusVisualPrimaryBrush=#FF000000
Visibility=Visible
RenderSize=30,20
RenderSize=22,22
[Windows.UI.Xaml.Controls.Grid]
Padding=0,0,0,0
CornerRadius=0,0,0,0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@
FocusVisualPrimaryThickness=2,2,2,2
FocusVisualPrimaryBrush=#FF000000
Visibility=Visible
RenderSize=30,20
RenderSize=22,22
[Windows.UI.Xaml.Controls.Grid]
Padding=0,0,0,0
CornerRadius=0,0,0,0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@
FocusVisualPrimaryThickness=2,2,2,2
FocusVisualPrimaryBrush=#FF000000
Visibility=Visible
RenderSize=28,19
RenderSize=22,22
[Windows.UI.Xaml.Controls.Grid]
Padding=0,0,0,0
CornerRadius=0,0,0,0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@
FocusVisualPrimaryThickness=2,2,2,2
FocusVisualPrimaryBrush=#FF000000
Visibility=Visible
RenderSize=28,19
RenderSize=22,22
[Windows.UI.Xaml.Controls.Grid]
Padding=0,0,0,0
CornerRadius=0,0,0,0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@
FocusVisualPrimaryThickness=2,2,2,2
FocusVisualPrimaryBrush=#FF000000
Visibility=Visible
RenderSize=0,20
RenderSize=0,21.28125
[Windows.UI.Xaml.Controls.Grid]
Padding=0,0,0,0
CornerRadius=0,0,0,0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@
FocusVisualPrimaryThickness=2,2,2,2
FocusVisualPrimaryBrush=#FF000000
Visibility=Visible
RenderSize=0,20
RenderSize=0,21.28125
[Windows.UI.Xaml.Controls.Grid]
Padding=0,0,0,0
CornerRadius=0,0,0,0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@
FocusVisualPrimaryThickness=2,2,2,2
FocusVisualPrimaryBrush=#FF000000
Visibility=Visible
RenderSize=0,20
RenderSize=0,21.28125
[Windows.UI.Xaml.Controls.Grid]
Padding=0,0,0,0
CornerRadius=0,0,0,0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@
FocusVisualPrimaryThickness=2,2,2,2
FocusVisualPrimaryBrush=#FF000000
Visibility=Visible
RenderSize=0,19
RenderSize=0,21.28125
[Windows.UI.Xaml.Controls.Grid]
Padding=0,0,0,0
CornerRadius=0,0,0,0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@
FocusVisualPrimaryThickness=2,2,2,2
FocusVisualPrimaryBrush=#FF000000
Visibility=Visible
RenderSize=0,19
RenderSize=0,21.28125
[Windows.UI.Xaml.Controls.Grid]
Padding=0,0,0,0
CornerRadius=0,0,0,0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@
FocusVisualPrimaryThickness=2,2,2,2
FocusVisualPrimaryBrush=#FF000000
Visibility=Visible
RenderSize=0,20
RenderSize=0,21.28125
[Windows.UI.Xaml.Controls.Grid]
Padding=0,0,0,0
CornerRadius=0,0,0,0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@
FocusVisualPrimaryThickness=2,2,2,2
FocusVisualPrimaryBrush=#FF000000
Visibility=Visible
RenderSize=0,20
RenderSize=0,21.28125
[Windows.UI.Xaml.Controls.Grid]
Padding=0,0,0,0
CornerRadius=0,0,0,0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@
FocusVisualPrimaryThickness=2,2,2,2
FocusVisualPrimaryBrush=#FF000000
Visibility=Visible
RenderSize=0,20
RenderSize=0,21.28125
[Windows.UI.Xaml.Controls.Grid]
Padding=0,0,0,0
CornerRadius=0,0,0,0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@
FocusVisualPrimaryThickness=2,2,2,2
FocusVisualPrimaryBrush=#FF000000
Visibility=Visible
RenderSize=0,19
RenderSize=0,21.28125
[Windows.UI.Xaml.Controls.Grid]
Padding=0,0,0,0
CornerRadius=0,0,0,0
Expand Down
Loading