Skip to content

Commit 72bc163

Browse files
committed
fix one textblock style and add typography page
1 parent 208de7d commit 72bc163

File tree

7 files changed

+119
-5
lines changed

7 files changed

+119
-5
lines changed

MainDemo.Wpf/MainDemo.Wpf.csproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@
138138
<Compile Include="Trees.xaml.cs">
139139
<DependentUpon>Trees.xaml</DependentUpon>
140140
</Compile>
141+
<Compile Include="Typography.xaml.cs">
142+
<DependentUpon>Typography.xaml</DependentUpon>
143+
</Compile>
141144
<Page Include="Buttons.xaml">
142145
<SubType>Designer</SubType>
143146
<Generator>MSBuild:Compile</Generator>
@@ -234,6 +237,10 @@
234237
<SubType>Designer</SubType>
235238
<Generator>MSBuild:Compile</Generator>
236239
</Page>
240+
<Page Include="Typography.xaml">
241+
<SubType>Designer</SubType>
242+
<Generator>MSBuild:Compile</Generator>
243+
</Page>
237244
</ItemGroup>
238245
<ItemGroup>
239246
<Compile Include="Palette.xaml.cs">

MainDemo.Wpf/MainWindow.xaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
88
Title="Material Design in XAML" Height="800" Width="1100"
99
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
10-
TextElement.FontWeight="Medium"
11-
TextElement.FontSize="14"
10+
TextElement.FontWeight="Regular"
11+
TextElement.FontSize="13"
1212
TextOptions.TextFormattingMode="Ideal"
1313
TextOptions.TextRenderingMode="Auto"
1414
Background="{DynamicResource MaterialDesignPaper}"
@@ -84,6 +84,11 @@
8484
<wpfExample:Sliders />
8585
</domain:DemoItem.Content>
8686
</domain:DemoItem>
87+
<domain:DemoItem Name="Typography">
88+
<domain:DemoItem.Content>
89+
<wpfExample:Typography />
90+
</domain:DemoItem.Content>
91+
</domain:DemoItem>
8792
<domain:DemoItem Name="Cards">
8893
<domain:DemoItem.Content>
8994
<wpfExample:Cards />

MainDemo.Wpf/Typography.xaml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<UserControl x:Class="MaterialDesignColors.WpfExample.Typography"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
mc:Ignorable="d"
7+
d:DesignHeight="300" d:DesignWidth="300">
8+
<UserControl.Resources>
9+
<Style TargetType="TextBlock" BasedOn="{StaticResource MaterialDesignCaptionTextBlock}">
10+
<Setter Property="Opacity" Value=".68"></Setter>
11+
</Style>
12+
</UserControl.Resources>
13+
14+
<Grid Margin="32">
15+
<Grid.ColumnDefinitions>
16+
<ColumnDefinition Width="Auto" />
17+
<ColumnDefinition Width="64" />
18+
<ColumnDefinition Width="Auto" />
19+
</Grid.ColumnDefinitions>
20+
<Grid.RowDefinitions>
21+
<RowDefinition Height="Auto" />
22+
<RowDefinition Height="Auto" />
23+
<RowDefinition Height="Auto" />
24+
<RowDefinition Height="Auto" />
25+
<RowDefinition Height="Auto" />
26+
<RowDefinition Height="Auto" />
27+
<RowDefinition Height="Auto" />
28+
<RowDefinition Height="Auto" />
29+
<RowDefinition Height="Auto" />
30+
<RowDefinition Height="Auto" />
31+
<RowDefinition Height="Auto" />
32+
</Grid.RowDefinitions>
33+
<TextBlock Grid.Row="0" Grid.Column="0" Margin="0 26 0 0">Display 4 - MaterialDesignDisplay4TextBlock</TextBlock>
34+
<TextBlock Grid.Row="0" Grid.Column="2" Style="{StaticResource MaterialDesignDisplay4TextBlock}" Margin="0 4 0 4">Light 112sp</TextBlock>
35+
36+
<TextBlock Grid.Row="1" Grid.Column="0" Margin="0 12 0 0">Display 3 - MaterialDesignDisplay3TextBlock</TextBlock>
37+
<TextBlock Grid.Row="1" Grid.Column="2" Style="{StaticResource MaterialDesignDisplay3TextBlock}" Margin="0 4 0 4">Regular 56sp</TextBlock>
38+
39+
<TextBlock Grid.Row="2" Grid.Column="0" Margin="0 8 0 0">Display 2 - MaterialDesignDisplay2TextBlock</TextBlock>
40+
<TextBlock Grid.Row="2" Grid.Column="2" Style="{StaticResource MaterialDesignDisplay2TextBlock}" Margin="0 4 0 4">Regular 45sp</TextBlock>
41+
42+
<TextBlock Grid.Row="3" Grid.Column="0" Margin="0 8 0 0">Display 1 - MaterialDesignDisplay1TextBlock</TextBlock>
43+
<TextBlock Grid.Row="3" Grid.Column="2" Style="{StaticResource MaterialDesignDisplay1TextBlock}" Margin="0 4 0 4">Regular 34sp</TextBlock>
44+
45+
<TextBlock Grid.Row="4" Grid.Column="0" Margin="0 7 0 0">Headline - MaterialDesignHeadlineTextBlock</TextBlock>
46+
<TextBlock Grid.Row="4" Grid.Column="2" Style="{StaticResource MaterialDesignHeadlineTextBlock}" Margin="0 4 0 6">Regular 24sp</TextBlock>
47+
48+
<TextBlock Grid.Row="5" Grid.Column="0" Margin="0 7 0 0">Title - MaterialDesignTitleTextBlock</TextBlock>
49+
<TextBlock Grid.Row="5" Grid.Column="2" Style="{StaticResource MaterialDesignTitleTextBlock}" Margin="0 6 0 8">Medium 20sp</TextBlock>
50+
51+
<TextBlock Grid.Row="6" Grid.Column="0" VerticalAlignment="Center">Subheading - MaterialDesignSubheadingTextBlock</TextBlock>
52+
<TextBlock Grid.Row="6" Grid.Column="2" Style="{StaticResource MaterialDesignSubheadingTextBlock}" Margin="0 8 0 8">Regular 15sp</TextBlock>
53+
54+
<TextBlock Grid.Row="7" Grid.Column="0" VerticalAlignment="Center">Body 2 - MaterialDesignBody2TextBlock</TextBlock>
55+
<TextBlock Grid.Row="7" Grid.Column="2" Style="{StaticResource MaterialDesignBody2TextBlock}" Margin="0 8 0 8">Medium 13sp</TextBlock>
56+
57+
<TextBlock Grid.Row="8" Grid.Column="0" VerticalAlignment="Center">Body 1 - MaterialDesignBody1TextBlock</TextBlock>
58+
<TextBlock Grid.Row="8" Grid.Column="2" Style="{StaticResource MaterialDesignBody1TextBlock}" Margin="0 8 0 8">Regular 13sp</TextBlock>
59+
60+
<TextBlock Grid.Row="9" Grid.Column="0" VerticalAlignment="Center">Caption - MaterialDesignCaptionTextBlock</TextBlock>
61+
<TextBlock Grid.Row="9" Grid.Column="2" Style="{StaticResource MaterialDesignCaptionTextBlock}" Margin="0 8 0 8">Regular 12sp</TextBlock>
62+
63+
<TextBlock Grid.Row="10" Grid.Column="0" VerticalAlignment="Center">Button - MaterialDesignButtonTextBlock</TextBlock>
64+
<TextBlock Grid.Row="10" Grid.Column="2" Style="{StaticResource MaterialDesignButtonTextBlock}" Margin="0 8 0 8">MEDIUM (ALL CAPS) 14sp</TextBlock>
65+
66+
67+
68+
</Grid>
69+
</UserControl>

MainDemo.Wpf/Typography.xaml.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using System.Windows;
7+
using System.Windows.Controls;
8+
using System.Windows.Data;
9+
using System.Windows.Documents;
10+
using System.Windows.Input;
11+
using System.Windows.Media;
12+
using System.Windows.Media.Imaging;
13+
using System.Windows.Navigation;
14+
using System.Windows.Shapes;
15+
16+
namespace MaterialDesignColors.WpfExample
17+
{
18+
/// <summary>
19+
/// Interaction logic for Typography.xaml
20+
/// </summary>
21+
public partial class Typography : UserControl
22+
{
23+
public Typography()
24+
{
25+
InitializeComponent();
26+
}
27+
}
28+
}

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Button.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<Setter Property="Cursor" Value="Hand"/>
2929
<Setter Property="wpf:ShadowAssist.ShadowDepth" Value="Depth1" />
3030
<Setter Property="TextBlock.FontWeight" Value="DemiBold"/>
31-
<Setter Property="TextBlock.FontSize" Value="15"/>
31+
<Setter Property="TextBlock.FontSize" Value="14"/>
3232
<Setter Property="BorderThickness" Value="1"/>
3333
<Setter Property="HorizontalContentAlignment" Value="Center"/>
3434
<Setter Property="VerticalContentAlignment" Value="Center"/>

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Defaults.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.ScrollViewer.xaml" />
2626
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/materialdesigntheme.slider.xaml" />
2727
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/materialdesigntheme.textbox.xaml" />
28+
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.TextBlock.xaml" />
2829
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/materialdesigntheme.togglebutton.xaml" />
2930
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.ToolBar.xaml" />
3031
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.ToolBarTray.xaml" />
@@ -51,7 +52,7 @@
5152
<Style TargetType="{x:Type ScrollBar}" BasedOn="{StaticResource MaterialDesignScrollBar}" />
5253
<Style TargetType="{x:Type ScrollViewer}" BasedOn="{StaticResource MaterialDesignScrollViewer}" />
5354
<Style TargetType="{x:Type Slider}" BasedOn="{StaticResource MaterialDesignSlider}" />
54-
<Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource MaterialDesignTextBox}" />
55+
<Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource MaterialDesignTextBox}" />
5556
<Style TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource MaterialDesignSwitchToggleButton}" />
5657
<Style TargetType="{x:Type ToolBar}" BasedOn="{StaticResource MaterialDesignToolBar}" />
5758
<Style TargetType="{x:Type ToolBarTray}" BasedOn="{StaticResource MaterialDesignToolBarTray}" />

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.TextBlock.xaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@
3838
</Style>
3939
<Style TargetType="{x:Type TextBlock}" x:Key="MaterialDesignDisplay4TextBlock">
4040
<Setter Property="FontSize" Value="112"/>
41-
<Setter Property="FontWeight" Value="Regular"/>
41+
<Setter Property="FontWeight" Value="Light"/>
4242
</Style>
43+
<Style TargetType="{x:Type TextBlock}" x:Key="MaterialDesignButtonTextBlock">
44+
<Setter Property="FontSize" Value="14"/>
45+
<Setter Property="FontWeight" Value="Medium"/>
46+
</Style>
4347
</ResourceDictionary>

0 commit comments

Comments
 (0)