How to clear last key pressed when simulating Tab

Dec 9, 2014 at 9:49 PM
I am trying to simulate Tab key down to put the keyboard focus on the next UI element. It works fine but if have a key already pressed then it does not work.

I have a WPF tab control with multiple tabs and we are allowing user to switch tabs by using the Ctrl+shift key combination.
When the user switch to next tab i have to put focus on the first control on that tab.

I listen for Key clicked event, in the event handler i switch the Tab and in the tab loaded event i am using Simulator for tab key down, but it does not work. I am guessing it has do something with Ctrl+shift key and the keyboard buffer is not cleared.