0
votes

I have Expander control which shows list of items when you expand it. If i do mouse hover over on header, it will expand it.

I need following things which needs to be implemented from code behind or in xaml.

1) if user do mouseover on expander header and press enter key then by default first item from the list needs to be selected.

2) if user do mouseover on one of the item of list and press enter key then we have to select perticular item. - I already have this implemented.

My question is I am able to capture enter key event in code behind but how would I know that user has mouse over on expander header or expander item as I have to do two diff things.

Thanks

Dee

1

1 Answers

0
votes

You can use Mouse.DirectlyOver to get the element it's over, you can then walk up the tree to see if you are in your relevant scope (i.e. find the expander/header), or you can check the IsMouseOver of the relevant controls instead, which should also return true if the mouse is over a child element.