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"即可

相关推荐
我是苏苏1 天前
WPF开发01:基础控件及常用模板篇
开发语言·c#·html·wpf
dalong102 天前
WPF:3D顶点共享与法线设置对光照效果的影响
3d·wpf
柔蘭2 天前
WPF中的CommunityToolkit.Mvvm框架
wpf
aGdF8E3gQ3 天前
【Application Insights】采样率对Function App日志收集的影响和解决方法
python·flask·wpf
程序员-Benothing4 天前
如何实现高并发系统订单30分钟自动关闭?
开发语言·c#·wpf
一水4 天前
Redis实战:一个AI工作流系统里的五个应用场景,从传参到限流的完整链路
数据库·redis·wpf
dalong104 天前
WPF:3D甜甜圈
3d·c#·wpf·甜甜圈
别催小唐敲代码4 天前
ROS2从入门到实战:去中心化机器人操作系统详解
wpf·ros2
脚踏实地皮皮晨5 天前
003006001_WrapPanel控件
开发语言·c#·.net·wpf·visual studio
脚踏实地皮皮晨5 天前
003005002_WPF StackPanel 基类官方类定义逐行深度解析
开发语言·windows·算法·c#·wpf·visual studio