Skip to content

Commit f96a1d6

Browse files
authored
Update MahApps resource keys to latest source (#1699)
* (GH-1698) Update MahApps color keys * Update Font keys * MahApps 2.0.0-alpha0748 need net452 * Fix find existing MahApps themes in MahAppsBundledTheme * Use updated Fonts * Update MaterialDesignAssist to use the new colors and brushes * Update MahApps.nuspec * Fix using of Font sizes * Update Flyout template * Remove unused ThicknessBindingConverter * Update NumericUpDown MouseOverBorderBrush * Use WindowButtonCommands.Win10 for sample
1 parent 40e7779 commit f96a1d6

14 files changed

+1046
-744
lines changed

MahMaterialDragablzMashUp/App.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<Application.Resources>
1313
<ResourceDictionary>
1414
<ResourceDictionary.MergedDictionaries>
15-
<materialDesign:MahAppsBundledTheme BaseTheme="Light" PrimaryColor="DeepPurple" SecondaryColor="LightBlue"/>
15+
<materialDesign:MahAppsBundledTheme BaseTheme="Light" PrimaryColor="DeepPurple" SecondaryColor="Purple"/>
1616

1717
<!-- MahApps -->
1818
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />

MahMaterialDragablzMashUp/Mah.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<TabItem Header="Button/Switch">
3838
<StackPanel>
3939
<smtx:XamlDisplay Key="ToggleSwitch_1" HorizontalAlignment="Left">
40-
<controls:ToggleSwitch IsChecked="True" HorizontalAlignment="Left" />
40+
<controls:ToggleSwitch IsOn="True" HorizontalAlignment="Left" />
4141
</smtx:XamlDisplay>
4242
<smtx:XamlDisplay Key="AccentSquareButton_1" HorizontalAlignment="Left">
4343
<Button Width="100" Margin="0 8 0 0" Content="Nice" HorizontalAlignment="Left"

MahMaterialDragablzMashUp/MainWindow.xaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,14 @@
1010
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
1111
Background="{DynamicResource MaterialDesignPaper}"
1212
GlowBrush="{DynamicResource MahApps.Brushes.Accent}"
13-
FontFamily="{StaticResource MahApps.Fonts.Default}"
13+
FontFamily="{DynamicResource MahApps.Fonts.Family.Window.Title}"
1414
Title="Material-MahApps-Dragablz Mash Up" Height="640" Width="800">
1515
<Window.CommandBindings>
1616
<CommandBinding Command="Copy" Executed="OnCopy" />
1717
</Window.CommandBindings>
18+
<controls:MetroWindow.WindowButtonCommands>
19+
<controls:WindowButtonCommands Style="{DynamicResource MahApps.Styles.WindowButtonCommands.Win10}" />
20+
</controls:MetroWindow.WindowButtonCommands>
1821
<controls:MetroWindow.Flyouts>
1922
<controls:FlyoutsControl>
2023
<controls:Flyout x:Name="LeftFlyout" Position="Left" Header="Settings" wpf:FlyoutAssist.HeaderColorMode="Accent">

MaterialDesignThemes.MahApps.nuspec

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,20 @@
1515
<copyright>$copyright$</copyright>
1616
<tags>WPF XAML MahApps Material Design Theme Colour Color UI UX</tags>
1717
<dependencies>
18-
<group targetFramework=".NETFramework4.5">
18+
<group targetFramework="net452">
1919
<dependency id="MaterialDesignColors" version="[1.2.1, 2.0)" />
2020
<dependency id="MaterialDesignThemes" version="[3.0.0, 4.0)" />
21-
<dependency id="MahApps.Metro" version="[2.0.0-alpha0660, 3.0)" />
21+
<dependency id="MahApps.Metro" version="[2.0.0-alpha0748, 3.0)" />
2222
</group>
23-
<group targetFramework=".NETCoreApp3.1">
23+
<group targetFramework="netcoreapp3.1">
2424
<dependency id="MaterialDesignColors" version="[1.2.1, 2.0)" />
2525
<dependency id="MaterialDesignThemes" version="[3.0.0, 4.0)" />
26-
<dependency id="MahApps.Metro" version="[2.0.0-alpha0660, 3.0)" />
26+
<dependency id="MahApps.Metro" version="[2.0.0-alpha0748, 3.0)" />
2727
</group>
2828
</dependencies>
2929
</metadata>
3030
<files>
31-
<file src="MaterialDesignThemes.MahApps\bin\$configuration$\net45\MaterialDesignThemes.MahApps.*" target="lib\net45" exclude="**\*.json" />
31+
<file src="MaterialDesignThemes.MahApps\bin\$configuration$\net452\MaterialDesignThemes.MahApps.*" target="lib\net452" exclude="**\*.json" />
3232
<file src="MaterialDesignThemes.MahApps\bin\$configuration$\netcoreapp3.1\MaterialDesignThemes.MahApps.*" target="lib\netcoreapp3.1" exclude="**\*.json" />
3333
</files>
3434
</package>

MaterialDesignThemes.MahApps/MahAppsBundledTheme.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static ResourceDictionary GetResourceDictionary(ITheme theme, PrimaryColor prima
5959
string colorScheme = $"MaterialDesign.{primaryColor}.{secondaryColor}";
6060

6161
ResourceDictionary rv;
62-
if (ThemeManager.Themes.FirstOrDefault(x => x.BaseColorScheme == baseColorScheme && x.ColorScheme == colorScheme) is global::MahApps.Metro.Theme mahAppsTheme)
62+
if (ThemeManager.Themes.FirstOrDefault(x => x.BaseColorScheme == baseColorScheme && x.ColorScheme == primaryColor.ToString()) is global::MahApps.Metro.Theme mahAppsTheme)
6363
{
6464
rv = mahAppsTheme.Resources;
6565
rv.SetMahApps(theme, baseTheme);

MaterialDesignThemes.MahApps/MaterialDesignAssist.cs

Lines changed: 412 additions & 115 deletions
Large diffs are not rendered by default.

MaterialDesignThemes.MahApps/MaterialDesignThemes.MahApps.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
33
<PropertyGroup>
4-
<TargetFrameworks>net45;netcoreapp3.1</TargetFrameworks>
4+
<TargetFrameworks>net452;netcoreapp3.1</TargetFrameworks>
55
<UseWPF>true</UseWPF>
66
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
77
<MDIXMahAppsVersion Condition="$(MDIXMahAppsVersion) == '' Or $(MDIXMahAppsVersion) == '*Undefined*'">1.0.1</MDIXMahAppsVersion>

MaterialDesignThemes.MahApps/Themes/MaterialDesignTheme.MahApps.Defaults.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<Style x:Key="MahApps.Styles.NumericUpDown.DataGridColumnEditing"
3030
BasedOn="{StaticResource MahApps.Styles.NumericUpDown.DataGridColumn}"
3131
TargetType="{x:Type controls:NumericUpDown}">
32-
<Setter Property="Background" Value="{DynamicResource MahApps.Brushes.White}" />
32+
<Setter Property="Background" Value="{DynamicResource MahApps.Brushes.ThemeBackground}" />
3333
<Setter Property="HideUpDownButtons" Value="False" />
3434
</Style>
3535
</ResourceDictionary>

MaterialDesignThemes.MahApps/Themes/MaterialDesignTheme.MahApps.Flyout.xaml

Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
</i:Interaction.Triggers>
3232
<wpf:PackIcon Kind="ChevronRight"
3333
FlowDirection="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type mah:Flyout}}, Path=FlowDirection}"
34-
Width="{DynamicResource MahApps.Sizes.Font.FlyoutHeader}"
35-
Height="{DynamicResource MahApps.Sizes.Font.FlyoutHeader}" />
34+
Width="{DynamicResource MahApps.Font.Size.Flyout.Header}"
35+
Height="{DynamicResource MahApps.Font.Size.Flyout.Header}" />
3636
</Button>
3737
<ContentControl x:Name="PART_BackHeaderText"
3838
Margin="15 0 0 0"
@@ -45,14 +45,14 @@
4545
</wpf:ColorZone>
4646
<DataTemplate.Triggers>
4747
<DataTrigger Binding="{Binding Position, RelativeSource={RelativeSource AncestorType={x:Type mah:Flyout}}}" Value="Left">
48-
<Setter TargetName="PART_BackHeaderText" Property="Margin" Value="0 0 15 0" />
49-
<Setter TargetName="PART_BackHeaderText" Property="HorizontalAlignment" Value="Right" />
5048
<Setter TargetName="PART_BackButton" Property="DockPanel.Dock" Value="Right" />
5149
<Setter TargetName="PART_BackButton" Property="LayoutTransform">
5250
<Setter.Value>
5351
<ScaleTransform ScaleX="-1" />
5452
</Setter.Value>
5553
</Setter>
54+
<Setter TargetName="PART_BackHeaderText" Property="HorizontalAlignment" Value="Right" />
55+
<Setter TargetName="PART_BackHeaderText" Property="Margin" Value="0 0 15 0" />
5656
</DataTrigger>
5757
<DataTrigger Binding="{Binding Position, RelativeSource={RelativeSource AncestorType={x:Type mah:Flyout}}}" Value="Top">
5858
<Setter TargetName="PART_ColorZone" Property="VerticalAlignment" Value="Stretch" />
@@ -74,33 +74,38 @@
7474
</DataTemplate>
7575

7676
<ControlTemplate x:Key="FlyoutTemplate" TargetType="{x:Type mah:Flyout}">
77-
<Grid x:Name="PART_Root"
78-
Background="{TemplateBinding Background}">
79-
<Grid.RenderTransform>
77+
<Border x:Name="PART_Root"
78+
Background="{TemplateBinding Background}"
79+
BorderBrush="{TemplateBinding BorderBrush}"
80+
BorderThickness="{TemplateBinding BorderThickness}">
81+
<Border.RenderTransform>
8082
<TranslateTransform />
81-
</Grid.RenderTransform>
82-
<AdornerDecorator x:Name="PART_Border" CacheMode="{Binding RelativeSource={RelativeSource Self}, Path=(wpf:ShadowAssist.CacheMode)}">
83-
<Border Background="{TemplateBinding Background}" Effect="{DynamicResource MaterialDesignShadowDepth5}" />
84-
</AdornerDecorator>
85-
<AdornerDecorator>
86-
<DockPanel FocusVisualStyle="{x:Null}" Focusable="False">
87-
<mah:MetroThumbContentControl x:Name="PART_Header"
88-
Content="{TemplateBinding Header}"
89-
ContentCharacterCasing="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(mah:ControlsHelper.ContentCharacterCasing)}"
90-
ContentStringFormat="{TemplateBinding HeaderStringFormat}"
91-
ContentTemplate="{TemplateBinding HeaderTemplate}"
92-
ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
93-
DockPanel.Dock="Top"
94-
FontFamily="{TemplateBinding mah:HeaderedControlHelper.HeaderFontFamily}"
95-
FontSize="{TemplateBinding mah:HeaderedControlHelper.HeaderFontSize}"
96-
FontStretch="{TemplateBinding mah:HeaderedControlHelper.HeaderFontStretch}"
97-
FontWeight="{TemplateBinding mah:HeaderedControlHelper.HeaderFontWeight}"
98-
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
99-
<ContentPresenter x:Name="PART_Content"
100-
ContentSource="Content"
101-
DockPanel.Dock="Bottom" />
102-
</DockPanel>
103-
</AdornerDecorator>
83+
</Border.RenderTransform>
84+
<Grid>
85+
<AdornerDecorator x:Name="PART_ShadowBorder" CacheMode="{Binding RelativeSource={RelativeSource Self}, Path=(wpf:ShadowAssist.CacheMode)}">
86+
<Border Background="{TemplateBinding Background}" Effect="{DynamicResource MaterialDesignShadowDepth5}" />
87+
</AdornerDecorator>
88+
<AdornerDecorator>
89+
<DockPanel FocusVisualStyle="{x:Null}" Focusable="False">
90+
<mah:MetroThumbContentControl x:Name="PART_Header"
91+
Padding="0"
92+
Content="{TemplateBinding Header}"
93+
ContentCharacterCasing="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(mah:ControlsHelper.ContentCharacterCasing)}"
94+
ContentStringFormat="{TemplateBinding HeaderStringFormat}"
95+
ContentTemplate="{TemplateBinding HeaderTemplate}"
96+
ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
97+
DockPanel.Dock="Top"
98+
FontFamily="{TemplateBinding mah:HeaderedControlHelper.HeaderFontFamily}"
99+
FontSize="{TemplateBinding mah:HeaderedControlHelper.HeaderFontSize}"
100+
FontStretch="{TemplateBinding mah:HeaderedControlHelper.HeaderFontStretch}"
101+
FontWeight="{TemplateBinding mah:HeaderedControlHelper.HeaderFontWeight}"
102+
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
103+
<ContentPresenter x:Name="PART_Content"
104+
ContentSource="Content"
105+
DockPanel.Dock="Bottom" />
106+
</DockPanel>
107+
</AdornerDecorator>
108+
</Grid>
104109
<VisualStateManager.VisualStateGroups>
105110
<VisualStateGroup>
106111
<VisualState x:Name="Default" />
@@ -131,7 +136,7 @@
131136
Value="0" />
132137
</DoubleAnimationUsingKeyFrames>
133138
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
134-
Storyboard.TargetName="PART_Border"
139+
Storyboard.TargetName="PART_ShadowBorder"
135140
Storyboard.TargetProperty="(UIElement.Opacity)">
136141
<SplineDoubleKeyFrame KeySpline="0.25,1,0.05,1"
137142
KeyTime="00:00:00.750"
@@ -206,7 +211,7 @@
206211
</VisualState>
207212
</VisualStateGroup>
208213
</VisualStateManager.VisualStateGroups>
209-
</Grid>
214+
</Border>
210215
<ControlTemplate.Triggers>
211216
<Trigger Property="Position" Value="Top">
212217
<Setter TargetName="PART_Content" Property="DockPanel.Dock" Value="Right" />
@@ -236,6 +241,7 @@
236241
<Style TargetType="{x:Type mah:Flyout}">
237242
<Setter Property="Foreground" Value="{DynamicResource MaterialDesignBody}" />
238243
<Setter Property="Background" Value="{DynamicResource MaterialDesignPaper}" />
244+
<Setter Property="BorderThickness" Value="0" />
239245
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
240246
<Setter Property="mah:HeaderedControlHelper.HeaderFontSize" Value="{DynamicResource MahApps.Font.Size.Flyout.Header}" />
241247
<Setter Property="mah:HeaderedControlHelper.HeaderMargin" Value="10" />
Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
22
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
33

4-
<FontFamily x:Key="MahApps.Fonts.Default">pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto</FontFamily>
5-
<FontFamily x:Key="MahApps.Fonts.Header">pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto</FontFamily>
6-
<FontFamily x:Key="MahApps.Fonts.Content">pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto</FontFamily>
7-
<FontFamily x:Key="MahApps.Fonts.ToggleSwitch">pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto</FontFamily>
8-
<FontFamily x:Key="MahApps.Fonts.ToggleSwitch.Header">pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto</FontFamily>
9-
10-
<FontFamily x:Key="MahApps.Fonts.ToggleSwitch.Win10">pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto</FontFamily>
11-
<FontFamily x:Key="MahApps.Fonts.ToggleSwitch.Header.Win10">pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto</FontFamily>
4+
<FontFamily x:Key="MahApps.Fonts.Family.Button">pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto</FontFamily>
5+
<FontFamily x:Key="MahApps.Fonts.Family.Header">pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto</FontFamily>
6+
<FontFamily x:Key="MahApps.Fonts.Family.Window.Title">pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto</FontFamily>
7+
<FontFamily x:Key="MahApps.Fonts.Family.Control">pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto</FontFamily>
8+
<FontFamily x:Key="MahApps.Fonts.Family.ToggleSwitch">pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto</FontFamily>
9+
<FontFamily x:Key="MahApps.Fonts.Family.ToggleSwitch.Header">pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto</FontFamily>
1210

1311
</ResourceDictionary>

0 commit comments

Comments
 (0)