Open-source Tutorial - Material Design for WPF UI

安裝 Material Design Themes

  • 經過 NuGet 包管理器搜索自動安裝bash

  • 經過 NuGet 包管理器控制檯手動安裝app

    Install-Package MaterialDesignThemes

配置 App.xaml

  • 主題code

    • 對於 Light 主題(二選一):component

      < ResourceDictionary  Source = 「 pack:// application:,,, / MaterialDesignThemes.Wpf; component / Themes / MaterialDesignTheme.Light.xaml 」 />
    • 對於 Dark 主題(二選一):io

      < ResourceDictionary  Source = 「 pack:// application:,,, / MaterialDesignThemes.Wpf; component / Themes / MaterialDesignTheme.Dark.xaml 」 />
    • 默認class

      < ResourceDictionary  Source = 「 pack:// application:,,, / MaterialDesignThemes.Wpf; component / Themes / MaterialDesignTheme.Defaults.xaml 」 />
  • 顏色基礎

    < ResourceDictionary  Source = 「 pack:// application:,,, / MaterialDesignColors; component / Themes / Recommended / Primary / MaterialDesignColor.COLOR_NAME.xaml 」 />
    < ResourceDictionary  Source = 「 pack:// application:,,, / MaterialDesignColors; component / Themes / Recommended / Accent / MaterialDesignColor.COLOR_NAME.xaml 」 />

配置窗體

  • 基礎配置配置

    <Window [...]
            TextElement.Foreground="{DynamicResource MaterialDesignBody}"
            Background="{DynamicResource MaterialDesignPaper}"
            [...] >
  • 完整配置material-design

    <Window [...]
            TextElement.Foreground="{DynamicResource MaterialDesignBody}"
            Background="{DynamicResource MaterialDesignPaper}"
            TextElement.FontWeight="Medium"
            TextElement.FontSize="14"
            FontFamily="pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto"
            [...] >
相關文章
相關標籤/搜索