Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot Import System.Windows.Controls

I am trying to use System.Windows.Controls.TextChangedEventArgs, but I cannot import System.Windows.Controls. When I try to add a reference, System.Windows.Controls is not one of the assemblies that I can select.

Does anyone know how to resolve the issue?

like image 815
MageWind Avatar asked Feb 12 '13 15:02

MageWind


People also ask

How do I add a system Windows Reference reference in Visual Studio 2022?

If you're using Visual Studio 2022 open the Project Properties and check the Windows. Forms - Enable Windows Forms for this Project setting. Save this answer.

How do you add references to Windows controls?

Try typing "controls" in the search box (in the top right corner of the dialog box). System. Windows. Controls should appear in the list that's returned.


2 Answers

The accepted answer tells you the problem but does not tell you how to solve it.I'll just add this for future visitors. To solve this problem, you need to add the reference to PresentationFramework.dll.

1 Go to Solutions Explorer (it's on the right of your IDE) > Right click on References

enter image description here

2 Select Add Reference

in the window that opens, look for Presentation Framework, check the box and click okay. That's all. This is the way to add references to your project.

enter image description here

like image 110
Ojonugwa Jude Ochalifu Avatar answered Oct 19 '22 15:10

Ojonugwa Jude Ochalifu


System.Windows.Controls is a namespace that contains classes defined in PresentationFramework.dll.

However, if you don't already have a reference to that assembly, you're probably doing something wrong.
Are you sure you're actually using WPF?

like image 21
SLaks Avatar answered Oct 19 '22 15:10

SLaks