Using directive works...and doesn't.

Magnus Vinterhav 61 Reputation points

I am using core 3.1 and am writing a WPF application.
Visual Studio Community 2019 with all updates applied.
All project are using core 3.1 and in the csproj files I have <UseWPF>true</UseWPF>
I am also using a nuget package called "WriteableBitmapEx" Version="1.6.7"

In the xaml.cs file it works fine to use colors like this:
****listOfColors.Add(System.Windows.Media.Color.FromArgb((byte)0, (byte)i, (byte)i, (byte)i));****
includes are:
using System;
using System.Windows;
using System.Windows.Media.Imaging;
using System.Collections.Generic;
using StructureLibrary;

No problem there.
In another project which also uses core 3.1, I have the same includes, but the following happens.
When I write for example ****Color c = new System.Windows.Media.Color****
and checks the "using" includes for Color by going to definition, I find the definition, no problems, among these definitions are
public static Color FromRgb(byte r, byte g, byte b);

BUT when I try to continue my line above with ****Color c = new System.Windows.Media.Color.FromArgb((byte)0, (byte)x, (byte)y, (byte)255)****
intellisense can't find any FromArgb method.

It seems as if the using directive works, because I can see the definition, but it doesn't work, because I can't use it. Intellisense can't find the "FromArgb" method.

What am I doing wrong?

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,474 questions
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
8,943 questions
{count} votes

0 additional answers

Sort by: Most helpful