Niv Navick
Niv Navick

Reputation: 216

system.windows.form.key in WPF c#

I'm new to WPF and I want to use 'Keys' object in WPF. That's how my code looks like in WinForm

 public List<Keys> keysList= new List<Keys>();

I want to use this in my WPF app but it can't recognize 'Keys'. Is there any alternative? I searched the web and found nothing.

Thanks!!!!

Upvotes: 5

Views: 2946

Answers (3)

Alyafey
Alyafey

Reputation: 1453

Just delete the letter s from Keys to be Key

 public List<Key> keysList = new List<Key>();

Upvotes: 2

It&#39;sNotALie.
It&#39;sNotALie.

Reputation: 22814

You need to add a using System.Windows.Input statement at the top of your form. If that doesn't work, make sure you're referencing WindowsBase.dll.

Upvotes: 4

Adriaan Stander
Adriaan Stander

Reputation: 166606

I think you are using the Key Enumeration Namespace: System.Windows.Forms, where you should be using Key Enumeration Namespace: System.Windows.Input

Upvotes: 4

Related Questions