---
lang: ja-jp
breaks: true
---
# WPF .NET Core に MaterialDesignInXamlToolkit を適用する。 2021-05-19
> aterialDesignInXAML/MaterialDesignInXamlToolkit
> https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit
> Material Design Icons
> https://materialdesignicons.com/
> Keboo/MaterialDesignInXaml.Examples
> https://github.com/Keboo/MaterialDesignInXaml.Examples
> 5 Steps to Getting Started with Material Design In XAML
> https://intellitect.com/getting-started-material-design-in-xaml/
> Super Quick Start
> https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/wiki/Super-Quick-Start
> Getting Started
> https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/wiki/Getting-Started
>
## NuGet より、MaterialDesignThemes を追加

## NuGet より、ShowMeTheXAML.MSBuild を追加

## App.xaml
```xml=
<Application
・・・
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
>
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<materialDesign:BundledTheme
BaseTheme="Light"
PrimaryColor="DeepPurple"
SecondaryColor="Lime" />
<ResourceDictionary
Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
```
## MainWindow.xaml
```xml=
<Window
・・・
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:system="clr-namespace:System;assembly=mscorlib"
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
TextElement.FontWeight="Medium"
TextElement.FontSize="14"
TextOptions.TextFormattingMode="Ideal"
TextOptions.TextRenderingMode="Auto"
Background="{DynamicResource MaterialDesignPaper}"
FontFamily="{DynamicResource MaterialDesignFont}"
xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes"
・・・
>
<Grid>
<StackPanel
Orientation="Vertical">
<Button
Style="{StaticResource MaterialDesignRaisedButton}"
Width="100"
ToolTip="Resource name: MaterialDesignRaisedButton"
Content="_MID"
/>
</StackPanel>
</Grid>
</Window>
```
## 確認

###### tags: `WPF` `.NET Core` `MaterialDesignThemes` `XAML`