LoginSignup
0
0

Material Design In XAML Toolkit Ver 5.0.0

Posted at

WPFでMaterial Design In XAML Toolkitを使用する方法

MaterialDesignThemes
バージョン:5.0.0

インストール

MaterialDesignThemesをNuGetパッケージの管理からインストールしてください。
単にアプリケーションをMaterialDesignにしたい場合にはMaterialDesignColorsは不要です。

App.xamlに設定を追加

古い記事ではMaterialDesign3.Defaults.xamlの部分がMaterialDesign.Defaults.xamlとなっています。

App.xaml
<Application
    x:Class="MaterialDesign.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:MaterialDesign"
    xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
    StartupUri="MainWindow.xaml">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <materialDesign:BundledTheme BaseTheme="Dark" PrimaryColor="DeepPurple" SecondaryColor="Lime" />
                <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesign3.Defaults.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>

MainWindow.xamlの編集

使用するWindowにスタイルを追加

<Window [...]
        Style="{StaticResource MaterialDesignWindow}"
        [...] >
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0