I have a ListBox containing a specific data template show some part when the item is selected. This enable me to edit easily my item.
This is working fine, but I'd like that when my ListBox lose focus, the selectedIndex reset to -1. So the editing part of the item disapear.
The problem is that the listbox is considering that it lose focus even when I click on a button in the item data template.
So my idea was to handle the event MouseLease instead of LostFocus on my listbox. Then once I check that the listbox and all is childrens doesn't have focus, I put the selectedIndex to -1.
What I'd like to know is how I can check that my ListBox and all is children have lose the focus. I'd like not to have to build big function that will check each control in the listbox to see is children and the children of the children etc.
If you have any quick idea, they're will be welcomed.
View Complete Post