System.Windows.Input does not exist?

I have using System.Windows.Input; at the top of my program, but it gives me an error saying that:

The type or namespace name "Enter" does not exist in the namespace "System.Windows" (do you miss the assembly reference?)

And when I allow the IntelliSense pop-up window right after Windows , it only displays Forms as a valid parameter. I am using the .NET framework 4.0 in Visual C # 2010 Express ...

How can I fix this problem?

+8
c #
source share
5 answers

I suspect that you created a Windows Forms project instead of a WPF project.

The types contributing to System.Windows.Input are in PresentationCore.dll and potentially other WPF-related assemblies.

I don’t know enough about types in System.Windows.Input to say for sure whether you can use them in a Windows Forms application, but I would at least recommend that you decide whether to go with Windows Forms or WPF, and then use types designed for this user interface platform.

+14
source share

For reference, you can access the System.Windows.Input namespace through a reference to the WindowsBase assembly .

Tested using .Net 4.5 class library (to map System.Windows.Input.Key events to a prism).

+7
source share

I added User Control (WPF) to the project. This includes the required links. You can delete it immediately after compiling the program. Hope this works for you.

+1
source share

The DLL that contains this library and namespace is not currently mentioned in your project.

Add a link to this DLL in your project, and then you can link to it.

The DLL described is part of the WPF framework. I included a screenshot of a sample WPF application. When you create a WPF application, you automatically get a link to the presentation environment. Also, note that you can add old Windows Forms links if you want. If you are not building a WPF application, this link must be added manually.

But I would suggest that you are creating a WPF application or a Winforms application, not a combination of both.

enter image description here

0
source share

No need to go through all this, just add the PresentationCore application to the application. You can do this by simply adding a link to this DLL.

-one
source share

All Articles