WPFはMaterialDesignコントロールライブラリを使用
10837 ワード
せつぞく
公式サイト:リンク:http://materialdesigninxaml.net.
GitHubソースおよびDemoAppアドレス:https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/releases.
使用
1.インストール
NuGetにMaterialDesignThemes
をインストールする
2.構成の追加
Appでxamlファイルに追加
3.ネーミングスペースの導入
必要なフォームに追加:xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes”
4.コントロールの使用
1)ダウンロードしたDemoAppを開き使用するコントロールを選択します.
)プログラムにコピー
3)実行効果追加成功
5.テーマスタイルの変更
Appでxamlファイルには、浅い色、中色、濃い色の3つのレベルが追加されています.
効果
公式サイト:リンク:http://materialdesigninxaml.net.
GitHubソースおよびDemoAppアドレス:https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/releases.
使用
1.インストール
NuGetにMaterialDesignThemes

2.構成の追加
Appでxamlファイルに追加
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.DeepPurple.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Lime.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
3.ネーミングスペースの導入
必要なフォームに追加:xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes”
<Window x:Class="HostComputer.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:HostComputer"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
4.コントロールの使用
1)ダウンロードしたDemoAppを開き使用するコントロールを選択します.



5.テーマスタイルの変更
Appでxamlファイルには、浅い色、中色、濃い色の3つのレベルが追加されています.
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.DeepPurple.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Lime.xaml"/>
</ResourceDictionary.MergedDictionaries>
<SolidColorBrush x:Key="PrimaryHueLightBrush" Color="#ffc947"/>
<SolidColorBrush x:Key="PrimaryHueLightForegroundBrush" Color="#ffffff"/>
<SolidColorBrush x:Key="PrimaryHueMidBrush" Color="#ff9800"/>
<SolidColorBrush x:Key="PrimaryHueMidForegroundBrush" Color="#ffffff"/>
<SolidColorBrush x:Key="PrimaryHueDarkBrush" Color="#c66900"/>
<SolidColorBrush x:Key="PrimaryHueDarkForegroundBrush" Color="#ffffff"/>
</ResourceDictionary>
</Application.Resources>
効果
