我希望在按下 Alt + Tab
时更改 ItemSource
或其他内容,那么如何实现呢?我尝试过下面的代码,但在 WPF 中不起作用:
void MainWindow_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Tab && (Keyboard.Modifiers & ModifierKeys.Alt) == ModifierKeys.Alt)
{
MessageBox.Show("CTRL + TAB trapped");
}
}