Jasper Adams
Jasper Adams

Reputation:

Disable F10 from activating window menu in WPF

I'm trying to figure out a way to prevent F10 from activating the window menu (same function as pressing 'alt') and fire keydown/previewkeydown instead. I know there are ways to do it using window.forms, but I'm using WPF on VB.net and I can't seem to find a method that would apply.

Upvotes: 4

Views: 2015

Answers (1)

Kyle Rosendo
Kyle Rosendo

Reputation: 25277

You should use e.SuppressKeyPress = True in the Event Handler to achieve this.

Cheers,

Kyle


EDIT: My mistake, sorry.

Well then what you could do is do your catch code for your F keys before a e.Handled = true, which should clear the WM_Chars queue, meaning that the main control would not get the event. Also maybe look into WPF Commands to work into this way of working. I don't know of a very "clean" solution to this problem. Sorry.

Upvotes: 2

Related Questions