wpf 项目中使用 Prism + MaterialDesign

1.通过nuget安装MaterialDesign

2.通过nuget安装Prism

3.修改App.xmal

复制代码
<prism:PrismApplication x:Class="VisionMeasureGlue.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                        xmlns:prism="http://prismlibrary.com/"
                        xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
                        >
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <materialDesign:BundledTheme BaseTheme="Light" PrimaryColor="DeepPurple" SecondaryColor="Lime" />
                <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
 
                
                <ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/SkinDefault.xaml"/>
                <ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Theme.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</prism:PrismApplication>

红色矩形框是需要更改的地方

3.修改app.xmal.cs文件

复制代码
    public partial class App : PrismApplication
    {
        System.Threading.Mutex mutex;
        protected override System.Windows.Window CreateShell()
        {
            return Container.Resolve<BasicDemoWindow>();
        }
        protected override void RegisterTypes(IContainerRegistry containerRegistry)
        {

        } 

修改红色矩形框中的内容

至此,编译不出错,就算是好了

这时会出现两个窗体 记得删除 StartupUri="MainWindow.xaml"即可

相关推荐
IT小哥哥呀1 天前
基于windows的个人/团队的时间管理工具
windows·c#·wpf·时间管理
sczmzx1 天前
Cefsharp.WPF高分辨率下崩溃问题解决方案
wpf
cjp5602 天前
023.WPF combox控件数据绑定
wpf
Scout-leaf2 天前
WPF新手村教程(七)—— 终章(MVVM架构初见杀)
c#·wpf
极客智造2 天前
WPF DataGrid 多选绑定 + 强类型命令回调 通用解决方案
wpf
ZoeJoy82 天前
机器视觉C# 调用相机:从 USB 摄像头到海康工业相机(WinForms & WPF)
数码相机·c#·wpf
ALex_zry3 天前
C++高性能日志与监控系统设计
c++·unity·wpf
zhojiew3 天前
使用flink agent框架实现流式情感分析的示例
大数据·flink·wpf
海盗12343 天前
ScottPlot在WPF的基本使用和中文乱码问题
c#·.net·wpf
俄城杜小帅3 天前
C++线程异步和wpf中比较
java·c++·wpf