проект!

я есть проект WPF сApp.xaml (не словарь ресурсов) с некоторыми материалами для проектирования материалов и ViewModelLocator (MVVM), который выглядит следующим образом:

<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml">
            </ResourceDictionary>
            <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml">
            </ResourceDictionary>
            <!--<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.DeepPurple.xaml">
            </ResourceDictionary>
            <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Lime.xaml">
            </ResourceDictionary>-->
            <!-- primary color -->
            <ResourceDictionary>
                <!-- include your primary palette -->
                <ResourceDictionary.MergedDictionaries>
                    <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/MaterialDesignColor.teal.xaml">
                    </ResourceDictionary>
                </ResourceDictionary.MergedDictionaries>
                <!--
                        include three hues from the primary palette (and the associated forecolours).
                        Do not rename, keep in sequence; light to dark.
                    -->
                <SolidColorBrush x:Key="PrimaryHueLightBrush"
                                 Color="{StaticResource Primary100}" />
                <SolidColorBrush x:Key="PrimaryHueLightForegroundBrush"
                                 Color="{StaticResource Primary100Foreground}" />
                <SolidColorBrush x:Key="PrimaryHueMidBrush"
                                 Color="{StaticResource Primary500}" />
                <SolidColorBrush x:Key="PrimaryHueMidForegroundBrush"
                                 Color="{StaticResource Primary500Foreground}" />
                <SolidColorBrush x:Key="PrimaryHueDarkBrush"
                                 Color="{StaticResource Primary700}" />
                <SolidColorBrush x:Key="PrimaryHueDarkForegroundBrush"
                                 Color="{StaticResource Primary700Foreground}" />
            </ResourceDictionary>
            <!-- secondary colour -->
            <ResourceDictionary>
                <!-- include your secondary pallette -->
                <ResourceDictionary.MergedDictionaries>
                    <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/MaterialDesignColor.teal.xaml">
                    </ResourceDictionary>
                </ResourceDictionary.MergedDictionaries>
                <!-- include a single secondary accent color (and the associated forecolour) -->
                <SolidColorBrush x:Key="SecondaryAccentBrush"
                                 Color="{StaticResource Accent200}" />
                <SolidColorBrush x:Key="SecondaryAccentForegroundBrush"
                                 Color="{StaticResource Accent200Foreground}" />
            </ResourceDictionary>
            <!-- Include the Dragablz Material Design style -->
            <ResourceDictionary Source="pack://application:,,,/Dragablz;component/Themes/materialdesign.xaml">
            </ResourceDictionary>

            <ResourceDictionary Source="Resources/CustomMaterialDesignControls.xaml" />

        </ResourceDictionary.MergedDictionaries>
        <!-- tell Dragablz tab control to use the Material Design theme -->
        <Style TargetType="{x:Type dragablz:TabablzControl}"
               BasedOn="{StaticResource MaterialDesignTabablzControlStyle}" />
        <vm:ViewModelLocator x:Key="Locator"
                             d:IsDataSource="True"
                             xmlns:vm="clr-namespace:**WPFProject**.ViewModels" />
    </ResourceDictionary>
</Application.Resources>

Это прекрасно работает, когда я создаю окно в WPFProject.

Но у меня также есть проект библиотеки библиотеки WPF. Как я могу получить доступ к App.xaml из WPFProject в моем проекте Custom WPF.

Это Window.xaml в проекте Custom WPF Library:

<Window x:Class="**CustomWPFLibrary**.Views.PersonView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
    TextElement.Foreground="{DynamicResource MaterialDesignBody}"
    TextElement.FontWeight="Regular"
    TextElement.FontSize="12"
    TextOptions.TextFormattingMode="Ideal"
    TextOptions.TextRenderingMode="Auto"
    Background="{DynamicResource MaterialDesignPaper}"
    FontFamily="{DynamicResource MaterialDesignFont}"
    Title=" eFenKa - PERSONEN"
    WindowStyle="SingleBorderWindow"
    ResizeMode="CanResize"
    WindowStartupLocation="CenterScreen"
    WindowState="Maximized"
    DataContext="{Binding PersonViewModel, Mode=OneWay, Source={StaticResource Locator}}">
<Grid>

</Grid>

Локатор и материал MaterialDesign не могут быть решены. Есть идеи? Или это вообще возможно?

Ответы на вопрос(0)

Ваш ответ на вопрос