2015-05-18 102 views
-1

我想處理僅用於鼠標操作的按鈕MouseEnter事件。所以我必須檢測是否鼠標或鍵盤觸發MouseEnter如果按下空格鍵,將觸發WPF MouseEnter事件

private void button_onMouseEnter(object sender, MouseEventArgs e) 
{ 
    Button button = (Button)sender; 

    if (!button.IsMouseOver)   return; // not working 
    if (!button.IsMouseDirectlyOver) return; // not working 
    ... 
} 

回答

相關問題