WPF Material Design UI框架

编程入门 行业动态 更新时间:2024-10-19 05:18:21

WPF Material Design UI<a href=https://www.elefans.com/category/jswz/34/1770644.html style=框架"/>

WPF Material Design UI框架

前言

Material Design in xaml 是开源免费的ui框架,工控软件主打的就是简单界面。
以下简称MD

相关资源

MaterialDesignInXamlToolkit Github 地址

MD 快速启动

MD 案例压缩包

MD 框架使用

启动环境配置

安装Nuget包

App.xaml 配置

<Application x:Class="WpfApp1.App"xmlns=""xmlns:x=""xmlns:materialDesign=""StartupUri="MainWindow.xaml"><Application.Resources><ResourceDictionary><!--添加MD 资源包--><ResourceDictionary.MergedDictionaries><materialDesign:BundledTheme BaseTheme="Light"PrimaryColor="DeepPurple" SecondaryColor="Lime" /><ResourceDictionarySource="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" /></ResourceDictionary.MergedDictionaries></ResourceDictionary></Application.Resources>
</Application>

测试导入是否成功

MainWindow.xmal

<Window x:Class="WpfApp1.MainWindow"xmlns=""xmlns:x=""xmlns:d=""xmlns:mc=""xmlns:local="clr-namespace:WpfApp1"xmlns:MD=""xmlns:Views="clr-namespace:WpfApp1.Views" mc:Ignorable="d"Title="MainWindow" Height="450" Width="800"><Window.Resources><Style x:Key="my_text" TargetType="TextBlock"><Setter Property="FontSize" Value="30" /><Setter Property="Margin" Value="8" /></Style></Window.Resources><Window.DataContext><!--需要命名来指定数据源--><local:MainWindowViewModel x:Name="viewModel" /></Window.DataContext><Grid><!--不能直接写TitleValue,Binding数据源会有问题--><MD:Card><TabControl  MD:ColorZoneAssist.Mode="PrimaryLight"><TabItem Header="Tab 1"></TabItem><TabItem Header="Tab 2"></TabItem><TabItem Header="Tab 3"></TabItem></TabControl></MD:Card></Grid>
</Window>

MD 组件使用测试

Button

Card

<WrapPanel Margin="10"><Button Width="90" Content="Button" Margin="5"/><Button Margin="5" ><MD:PackIcon Kind="Alarm" Width="30" Height="25"/></Button>
</WrapPanel>


我后面想稍微改一下按钮,比如改个圆角,发现很麻烦,可能需要覆写控件模板。想想还是算了,先用官方的解决方案。先学套路,解决问题,再了解底层,扩展方法。

PopupBox

Chips

Color Tool

Colour Zones

ComboBoxes

Data Grids

Dialogs

Drawer

Elevation

Expander

Fields

Fields line up

Group Boxes

Icon Pack

Lists

Menus & Tool Bars

Navigation Rail

Palette

Pickers

Progress Indicators

Rating Bar

Sliders

Smart Hint

Snackbar

Tabs

Toggles

Transitions

Trees

Typography

更多推荐

WPF Material Design UI框架

本文发布于:2023-12-04 01:33:22,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1659366.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:框架   Material   WPF   UI   Design

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!