Skip to content

Commit c3a41ff

Browse files
Material Design 3: Various tasks completed (#2526)
* Copy of MaterialDesignTheme.Defaults.xaml made * MaterialDesignTheme.Defaults replaced by MaterialDesign2.Defaults * Noto Sans font added * Added Typography MaterialDesign3 * Add MaterialDesign3Demo with own namespace * TextBlock styles suffixed with 'TextBlock' * Changing Material Design 3 Typography page [wip] * Revert MaterialDesign2 -> MaterialDesignTheme * Add Typography Material Design 3 Demo * Set font to Noto for Material Design 3
1 parent 2c75cbc commit c3a41ff

File tree

160 files changed

+17538
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

160 files changed

+17538
-0
lines changed

MaterialDesign3.Demo.Wpf/App.config

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
5+
</startup>
6+
<appSettings>
7+
<add key="GitHub" value="https://github.com/ButchersBoy/MaterialDesignInXamlToolkit"/>
8+
</appSettings>
9+
</configuration>

MaterialDesign3.Demo.Wpf/App.manifest

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
3+
<assemblyIdentity version="1.0.0.0" name="MaterialDesign3Demo.app"/>
4+
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
5+
<security>
6+
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
7+
<!-- UAC Manifest Options
8+
If you want to change the Windows User Account Control level replace the
9+
requestedExecutionLevel node with one of the following.
10+
11+
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
12+
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
13+
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
14+
15+
Specifying requestedExecutionLevel element will disable file and registry virtualization.
16+
Remove this element if your application requires this virtualization for backwards
17+
compatibility.
18+
-->
19+
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
20+
</requestedPrivileges>
21+
</security>
22+
</trustInfo>
23+
24+
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
25+
<application>
26+
<!-- A list of the Windows versions that this application has been tested on and is
27+
is designed to work with. Uncomment the appropriate elements and Windows will
28+
automatically selected the most compatible environment. -->
29+
30+
<!-- Windows Vista -->
31+
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
32+
33+
<!-- Windows 7 -->
34+
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
35+
36+
<!-- Windows 8 -->
37+
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />
38+
39+
<!-- Windows 8.1 -->
40+
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />
41+
42+
<!-- Windows 10 -->
43+
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
44+
45+
</application>
46+
</compatibility>
47+
48+
<!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher
49+
DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need
50+
to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should
51+
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config. -->
52+
53+
<application xmlns="urn:schemas-microsoft-com:asm.v3">
54+
<windowsSettings>
55+
<!-- The combination of below two tags have the following effect :
56+
1) Per-Monitor for >= RS1 (Windows 10 Anniversary Update)
57+
2) System < RS1 -->
58+
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor, System</dpiAwareness>
59+
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
60+
</windowsSettings>
61+
</application>
62+
63+
64+
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
65+
<!--
66+
<dependency>
67+
<dependentAssembly>
68+
<assemblyIdentity
69+
type="win32"
70+
name="Microsoft.Windows.Common-Controls"
71+
version="6.0.0.0"
72+
processorArchitecture="*"
73+
publicKeyToken="6595b64144ccf1df"
74+
language="*"
75+
/>
76+
</dependentAssembly>
77+
</dependency>
78+
-->
79+
80+
</assembly>

MaterialDesign3.Demo.Wpf/App.xaml

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
<Application
2+
x:Class="MaterialDesign3Demo.App"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:smtx="clr-namespace:ShowMeTheXAML;assembly=ShowMeTheXAML"
6+
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
7+
xmlns:avalonEdit="http://icsharpcode.net/sharpdevelop/avalonedit"
8+
xmlns:smtxAe="clr-namespace:ShowMeTheXAML.AvalonEdit;assembly=ShowMeTheXAML.AvalonEdit"
9+
xmlns:system="clr-namespace:System;assembly=mscorlib"
10+
xmlns:materialDesignDemo="clr-namespace:MaterialDesign3Demo"
11+
StartupUri="MainWindow.xaml">
12+
<Application.Resources>
13+
<ResourceDictionary>
14+
<ResourceDictionary.MergedDictionaries>
15+
<!-- This is the current way to setup your app's initial theme -->
16+
<materialDesign:BundledTheme
17+
BaseTheme="Inherit"
18+
PrimaryColor="DeepPurple"
19+
SecondaryColor="Lime"
20+
ColorAdjustment="{materialDesign:ColorAdjustment}" />
21+
22+
<!-- If you would prefer to use your own colors there is an option for that as well -->
23+
<!--<materialDesign:CustomColorTheme BaseTheme="Light" PrimaryColor="Aqua" SecondaryColor="DarkGreen" />-->
24+
25+
<!-- You can also use the built in theme dictionaries as well
26+
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml" />
27+
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.DeepPurple.xaml" />
28+
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Lime.xaml" />
29+
-->
30+
31+
<ResourceDictionary
32+
Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesign3.Defaults.xaml" />
33+
34+
<ResourceDictionary
35+
Source="pack://application:,,,/ShowMeTheXAML.AvalonEdit;component/Themes/xamldisplayer.xaml" />
36+
</ResourceDictionary.MergedDictionaries>
37+
38+
<Style
39+
TargetType="smtx:XamlDisplay"
40+
BasedOn="{StaticResource {x:Type smtx:XamlDisplay}}">
41+
<Style.Resources>
42+
<ResourceDictionary>
43+
<ResourceDictionary.MergedDictionaries>
44+
<ResourceDictionary
45+
Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Button.xaml" />
46+
<ResourceDictionary
47+
Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.ToggleButton.xaml" />
48+
</ResourceDictionary.MergedDictionaries>
49+
50+
<smtxAe:TextDocumentValueConverter
51+
x:Key="TextDocumentValueConverter" />
52+
</ResourceDictionary>
53+
</Style.Resources>
54+
<Setter
55+
Property="IsTabStop"
56+
Value="False" />
57+
<Setter
58+
Property="VerticalContentAlignment"
59+
Value="Bottom" />
60+
<Setter
61+
Property="HorizontalContentAlignment"
62+
Value="Right" />
63+
<Setter
64+
Property="materialDesignDemo:XamlDisplayEx.ButtonDock"
65+
Value="Right" />
66+
<Setter
67+
Property="Formatter">
68+
<Setter.Value>
69+
<smtx:XamlFormatter
70+
NewLineOnAttributes="True"
71+
Indent=" ">
72+
<smtx:XamlFormatter.NamespacesToRemove>
73+
<system:String>http://materialdesigninxaml.net/winfx/xaml/themes</system:String>
74+
</smtx:XamlFormatter.NamespacesToRemove>
75+
</smtx:XamlFormatter>
76+
</Setter.Value>
77+
</Setter>
78+
<Setter
79+
Property="Template">
80+
<Setter.Value>
81+
<ControlTemplate
82+
TargetType="smtx:XamlDisplay">
83+
<DockPanel>
84+
<materialDesign:PopupBox
85+
DockPanel.Dock="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(materialDesignDemo:XamlDisplayEx.ButtonDock)}"
86+
IsTabStop="False"
87+
Padding="10"
88+
StaysOpen="True"
89+
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
90+
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
91+
x:Name="PopupBox">
92+
<materialDesign:PopupBox.ToggleContent>
93+
<materialDesign:PackIcon
94+
Kind="Xml"
95+
Cursor="Hand"
96+
ToolTip="View XAML"
97+
Foreground="{DynamicResource PrimaryHueDarkBrush}"
98+
Background="Transparent"
99+
Margin="3">
100+
<materialDesign:PackIcon.Style>
101+
<Style
102+
TargetType="materialDesign:PackIcon"
103+
BasedOn="{StaticResource {x:Type materialDesign:PackIcon}}">
104+
<Setter
105+
Property="Opacity"
106+
Value="0.4" />
107+
<Style.Triggers>
108+
<Trigger
109+
Property="IsMouseOver"
110+
Value="True">
111+
<Setter
112+
Property="Opacity"
113+
Value="1" />
114+
</Trigger>
115+
</Style.Triggers>
116+
</Style>
117+
</materialDesign:PackIcon.Style>
118+
</materialDesign:PackIcon>
119+
</materialDesign:PopupBox.ToggleContent>
120+
<Border
121+
MaxHeight="600"
122+
MaxWidth="800">
123+
<DockPanel>
124+
<Button
125+
Margin="0 10 0 0"
126+
Tag="{Binding Xaml, RelativeSource={RelativeSource TemplatedParent}}"
127+
HorizontalAlignment="Right"
128+
Command="Copy"
129+
CommandParameter="{Binding Xaml, RelativeSource={RelativeSource TemplatedParent}}"
130+
Content="_COPY"
131+
DockPanel.Dock="Bottom"
132+
Style="{StaticResource MaterialDesignRaisedButton}">
133+
</Button>
134+
<avalonEdit:TextEditor
135+
Document="{Binding Xaml, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource TextDocumentValueConverter}}"
136+
Style="{StaticResource AvalonTextEditorXamlDisplay}" />
137+
</DockPanel>
138+
</Border>
139+
140+
</materialDesign:PopupBox>
141+
<Grid>
142+
<AdornerDecorator>
143+
<Border
144+
BorderBrush="{DynamicResource SecondaryHueMidBrush}"
145+
Opacity=".4"
146+
Margin="-5">
147+
<Border.Style>
148+
<Style
149+
TargetType="Border">
150+
<Setter
151+
Property="BorderThickness"
152+
Value="0" />
153+
<Style.Triggers>
154+
<DataTrigger
155+
Binding="{Binding ElementName=PopupBox, Path=IsPopupOpen}"
156+
Value="True">
157+
<Setter
158+
Property="BorderThickness"
159+
Value="5" />
160+
</DataTrigger>
161+
</Style.Triggers>
162+
</Style>
163+
</Border.Style>
164+
</Border>
165+
</AdornerDecorator>
166+
<ContentPresenter />
167+
</Grid>
168+
</DockPanel>
169+
</ControlTemplate>
170+
</Setter.Value>
171+
</Setter>
172+
</Style>
173+
</ResourceDictionary>
174+
</Application.Resources>
175+
</Application>
176+
177+

MaterialDesign3.Demo.Wpf/App.xaml.cs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using System.Windows;
2+
using ShowMeTheXAML;
3+
4+
namespace MaterialDesign3Demo
5+
{
6+
/// <summary>
7+
/// Interaction logic for App.xaml
8+
/// </summary>
9+
public partial class App : Application
10+
{
11+
protected override void OnStartup(StartupEventArgs e)
12+
{
13+
//This is an alternate way to initialize MaterialDesignInXAML if you don't use the MaterialDesignResourceDictionary in App.xaml
14+
//Color primaryColor = SwatchHelper.Lookup[MaterialDesignColor.DeepPurple];
15+
//Color accentColor = SwatchHelper.Lookup[MaterialDesignColor.Lime];
16+
//ITheme theme = Theme.Create(new MaterialDesignLightTheme(), primaryColor, accentColor);
17+
//Resources.SetTheme(theme);
18+
19+
20+
//Illustration of setting culture info fully in WPF:
21+
/*
22+
Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR");
23+
Thread.CurrentThread.CurrentUICulture = new CultureInfo("fr-FR");
24+
FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(
25+
XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));
26+
*/
27+
28+
XamlDisplay.Init();
29+
30+
// test setup for Persian culture settings
31+
/*System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("fa-Ir");
32+
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("fa-Ir");
33+
FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(
34+
System.Windows.Markup.XmlLanguage.GetLanguage(System.Globalization.CultureInfo.CurrentCulture.IetfLanguageTag)));*/
35+
36+
base.OnStartup(e);
37+
}
38+
}
39+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System.Windows;
2+
3+
namespace MaterialDesign3Demo
4+
{
5+
public static class ButtonAssist
6+
{
7+
public static readonly DependencyProperty UniformCornerRadiusProperty = DependencyProperty.RegisterAttached(
8+
"UniformCornerRadius", typeof(double), typeof(ButtonAssist), new PropertyMetadata(2.0, OnUniformCornerRadius));
9+
10+
private static void OnUniformCornerRadius(DependencyObject d, DependencyPropertyChangedEventArgs e)
11+
=> MaterialDesignThemes.Wpf.ButtonAssist.SetCornerRadius(d, new CornerRadius((double)e.NewValue));
12+
13+
public static void SetUniformCornerRadius(DependencyObject element, double value)
14+
=> element.SetValue(UniformCornerRadiusProperty, value);
15+
16+
public static double GetUniformCornerRadius(DependencyObject element)
17+
=> (double)element.GetValue(UniformCornerRadiusProperty);
18+
}
19+
}

0 commit comments

Comments
 (0)