I note that controls in WPF can have accelerators, assigned using the "_" character, as in, "myButton.Content = "_DoSomething". Typically, when the above accelerator is assigned, pressing the "Alt" key first displays the accelerator. Then pressing "D" does the action, pressing the button, in this case.
I want to programmatically fire the "Alt" key event, so that the user does not have to first press Alt. I recognize that there is a display properties option for this, but each user will have their unique setting and I do not want to alter their display properties.
I've tried code of this form:
KeyEventArgs e1 = new KeyEventArgs(Keyboard.PrimaryDevice, Keyboard.PrimaryDevice.ActiveSource, 0, Key.LeftAlt);
e1.RoutedEvent = Keyboard.KeyDownEvent;
myButton.RaiseEvent(e1);
But it doesn't quite do the trick. Can anyone h
View Complete Post