微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

MaterialDesignExtensions TabControl

如何解决MaterialDesignExtensions TabControl

我想将TabControl与MaterialDesignExtensions一起使用。在app.xaml中出现错误。我想念的是什么?

加载Nugets:

MaterialDesignColors v1.2.7 MaterialDesignThemes.Wpf v3.2.0 MaterialDesignExtensions v3.2.0

App.xaml

<Application x:Class="MyApp.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml"
xmlns:culture="clr-namespace:MyApp.Cultures"
xmlns:local="clr-namespace:MyApp"
xmlns:controls="clr-namespace:MaterialDesignExtensions.Controls;assembly=MaterialDesignExtensions"
>
<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="ResourceDictionary1.xaml"/>
            <ResourceDictionary Source="pack://application:,/MaterialDesignThemes.Wpf;component/Themes/Generic.xaml" />
            <ResourceDictionary Source="pack://application:,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
            <ResourceDictionary Source="pack://application:,/MaterialDesignExtensions;component/Themes/MaterialDesignDarkTheme.xaml"/>
            <ResourceDictionary Source="pack://application:,/MaterialDesignExtensions;component/Themes/Generic.xaml" />
            <!-- primary colors -->
            <ResourceDictionary>
                <ResourceDictionary.MergedDictionaries>
                    <ResourceDictionary Source="pack://application:,/MaterialDesignColors;component/Themes/MaterialDesignColor.Blue.xaml" />
                </ResourceDictionary.MergedDictionaries>
                <SolidColorBrush x:Key="PrimaryHueLightBrush" Color="{StaticResource Primary100}"/>
                <SolidColorBrush x:Key="PrimaryHueLightForegroundBrush" Color="{StaticResource Primary100Foreground}"/>
                <SolidColorBrush x:Key="PrimaryHueMidBrush" Color="#244886"/>
                <SolidColorBrush x:Key="PrimaryHueMidForegroundBrush" Color="{StaticResource Primary500Foreground}"/>
                <SolidColorBrush x:Key="PrimaryHueDarkBrush" Color="{StaticResource Primary600}"/>
                <SolidColorBrush x:Key="PrimaryHueDarkForegroundBrush" Color="{StaticResource Primary600Foreground}"/>
            </ResourceDictionary>

            <!-- accent color -->
            <ResourceDictionary>
                <ResourceDictionary.MergedDictionaries>
                    <ResourceDictionary Source="pack://application:,/MaterialDesignColors;component/Themes/MaterialDesignColor.Lime.xaml" />
                </ResourceDictionary.MergedDictionaries>
                <SolidColorBrush x:Key="SecondaryAccentBrush" Color="{StaticResource Accent400}"/>
                <SolidColorBrush x:Key="SecondaryAccentForegroundBrush" Color="{StaticResource Accent400Foreground}"/>
            </ResourceDictionary>

        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Application.Resources>
错误信息
An error occurred while finding the resource dictionary "pack://application:,/MaterialDesignExtension:component/Themes/Generic.xaml"

解决方法

我发现了这种解决方法,只是直接包含MaterialDesignExtension 3.2.0中的TabControl字典

<ResourceDictionary Source="pack://application:,/MaterialDesignExtensions;component/Themes/TabControlTemplates.xaml" />

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。