Kinnara / ModernWpf

Modern styles and controls for your WPF applications
MIT License
4.51k stars 450 forks source link

IntelliSense could not resolve the resource from ModernWPF #515

Open MarcoPasta opened 2 years ago

MarcoPasta commented 2 years ago

Hi,

first of all this is my first WPF project. I picked ModernWPF because material just didn't fit the topic of my project. After adding ModernWPF to my project and compiling everything was ok, but after adding my own UI elements i always got an error that resources could not be resolved or that System.Windows.StaticResourceExtension has no valid value for property "Style". I tried the fix from the FAQ and also tried the methods from #12 and #146 but these didn't worked for me sadly..

This is my .csproj

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net6.0-windows</TargetFramework>
    <RootNamespace>GUI_WS22_Kreuzfahrt</RootNamespace>
    <Nullable>enable</Nullable>
    <UseWPF>true</UseWPF>
  </PropertyGroup>

  <!--<ItemGroup>
    <Page Remove="Properties\DesignTimeResources.xaml" />
  </ItemGroup>-->

  <ItemGroup>
    <PackageReference Include="ModernWpfUI" Version="0.9.6" />
  </ItemGroup>

    <ItemGroup>
        <Page Remove="Properties\DesignTimeResources.xaml" />
    </ItemGroup>

    <ItemGroup>
        <Resource Include="Properties\DesignTimeResources.xaml">
            <ContainsDesignTimeResources>True</ContainsDesignTimeResources>
            <SubType>Designer</SubType>
            <Generator>MSBuild:Compile</Generator>
        </Resource>
    </ItemGroup>
</Project>

On root i have a directory called "Properties" that has the DesignTimeResources.xaml that contains the following:

<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ui="http://schemas.modernwpf.com/2019">
    <ResourceDictionary.MergedDictionaries>
        <ui:IntellisenseResources Source="/ModernWpf;component/DesignTime/DesignTimeResources.xaml" />
    </ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

Does someone one know why Intellisense is going wylde with this one?