我正在尝试使用 Behavior 来抓住钥匙
public class mONITORKeyDown : Behavior<UserControl>
{
public static readonly DependencyProperty _ShortCuts =
DependencyProperty.Register(
"ShortCuts",
typeof(Dictionary<Tuple<ModifierKeys, Key>, ICommand>),
typeof(BillingMangerKeyDown),
new PropertyMetadata( null));
protected override void OnAttached()
{
// ShortCuts = new Dictionary<Tuple<ModifierKeys, Key>, ICommand>();
AssociatedObject.KeyDown += _KeyBoardBehaviorKeyDown;
}
protected override void OnDetaching()
{
AssociatedObject.KeyDown -= _KeyBoardBehaviorKeyDown;
}
void _KeyBoardBehaviorKeyDown(object sender, KeyEventArgs e)
{
if(Keyboard.Modifiers == KeyModifiers.Control && e.Key==Key.Down)
}
}
问题是,一旦我单击 cntrl,它就会触发事件,然后单击 enter + 向下箭头没有任何作用