《WPF》UI框架MaterialDesignTheme的使用
《WPF》UI框架MaterialDesignTheme的使用
前言
一边学习一边记录
一、MaterialDesignTheme是什么?
MaterialDesignTheme是由Google推出的开源免费的UI框架。
二、使用步骤
1.引入库
使用NuGet添加Material Design资源
1.配置资源
在App.xaml中需要编写
代码如下:
<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>
也可以在里面添加主题颜色
<SolidColorBrush x:Key="PrimaryHueLightBrush" Color="#BBB" />
<SolidColorBrush x:Key="PrimaryHueLightForegroundBrush" Color="#BBB" />
<SolidColorBrush x:Key="PrimaryHueMidBrush" Color="#004098" />
<SolidColorBrush x:Key="PrimaryHueMidForegroundBrush" Color="White" />
<SolidColorBrush x:Key="PrimaryHueDarkBrush" Color="White" />
<SolidColorBrush x:Key="PrimaryHueDarkForegroundBrush" Color="#004098" />
<SolidColorBrush x:Key="SecondaryAccentBrush" Color="#004098" />
<SolidColorBrush x:Key="SecondaryAccentForegroundBrush" Color="Yellow" />
<SolidColorBrush x:Key="PrimaryLightBrush" Color="Red" />
<SolidColorBrush x:Key="PrimaryLightForegroundBrush" Color="Green" />
2.控件样式
需要在窗体的头部添加 xmlns:materialDesign=“http://materialdesigninxaml.net/winfx/xaml/themes”
2.1TextBox样式
//默认提示文字
materialDesign:HintAssist.Hint="输入查询条件"
//默认提示文字是否会悬浮在文本框上
materialDesign:HintAssist.IsFloating="False"
结束
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /boutique/detail/tanhiabbgf
系列文章
更多
同类精品
更多
-
photoshop保存的图片太大微信发不了怎么办
PHP中文网 06-15 -
word里面弄一个表格后上面的标题会跑到下面怎么办
PHP中文网 06-20 -
photoshop扩展功能面板显示灰色怎么办
PHP中文网 06-14 -
《学习通》视频自动暂停处理方法
HelloWorld317 07-05 -
Android 11 保存文件到外部存储,并分享文件
Luke 10-12 -
TikTok加速器哪个好免费的TK加速器推荐
TK小达人 10-01 -
微信公众号没有声音提示怎么办
PHP中文网 03-31 -
excel下划线不显示怎么办
PHP中文网 06-23 -
excel打印预览压线压字怎么办
PHP中文网 06-22 -
微信运动停用后别人还能看到步数吗
PHP中文网 07-22