I have a WPF project with App.xaml (not a resource dictionary) with some material design stuff and a ViewModelLocator(MVVM) that looks like this:
<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>
It works perfect when I create a Window in WPFProject.
But I also have a WPF Custome Library project. How can I acces the App.xaml from WPFProject in my Custom WPF project.
This is a Window.xaml in Custom WPF Library project:
<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>
Locator and the MaterialDesign stuff can't be resolved. Any ideas? Or is this even possible?