Accelerator Key problem in WPF TabControl and Tabitem [Resolved]

Posted by Peermohamedmydeen under WPF on 3/30/2011 | Points: 10 | Views : 2538 | Status : [Member] | Replies : 1
Hi All,

I am using a wpf TabControl, in which I have several TabItems and I added the Display Text property to the TabItem with mnemonics. But In a TabItem am having WebBrowser Control in the TabContent.

The problem is, while pressing a key in the webbrowser's page textbox, it triggers the accelerator key and navigating to the tabitem. For Example, See the code below...

<tabItem Header=_Veritas></TabItem>
<tabItem Header=_Zeus></TabItem>
<tabItem Header=_Sparta></TabItem>

In Sparta TabItem I have a webbrowser control and lets say I have a google search page in it... While am pressing the key V or Z its navigating to the tab Veritas or Zeus respectively with out pressing Alt Key. So I could not able to type in the google search textbox effectively.

How can I restrict this? Suggestions appreciated.


Posted by: Peermohamedmydeen on: 4/19/2011 [Member] Bronze | Points: 25


I solved it by adding a eventhandler and

Title="MainWindow" Height="350" Width="525"

and handle all events which don't have a alt modifier.

private void AccessKeyPressed(object sender, AccessKeyPressedEventArgs e) {

if ((Keyboard.Modifiers & ModifierKeys.Alt) != ModifierKeys.Alt) {
e.Target = null;
e.Handled = true;

Peermohamedmydeen, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response