-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
...
}