Hi Magnus,
FromArgb is a static method. Don't use keyword "new".
Color c = System.Windows.Media.Color.FromArgb((byte)0, (byte)x, (byte)y, (byte)255);
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
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?
Hi Magnus,
FromArgb is a static method. Don't use keyword "new".
Color c = System.Windows.Media.Color.FromArgb((byte)0, (byte)x, (byte)y, (byte)255);