Reputation: 361472
I've created a Google like SearchBox control in Silverlight. That means, as I type in the box, a DropDownListBox appears just below the SearchBox, showing all the items that match with the text I've typed in searchbox so far (i.e AutoComplete feature), exactly like this:
Now, I want to add a functionality to it : I want to make the DropDownListBox to disappear, as soon as user clicks outside it, or anywhere on the screen. I cannot handle MouseLeftButtonDown
(or any such event
) in other controls, to accomplish this, because users can click anywhere, including non-silverlight region. Can anybody suggest me what should I do to achieve this?
So my question basically is:
How to know if user has just clicked and the click event occurred outside a particular control?
Please note that AutoCompleteBox
doesn't serve my purpose. So I cannot use it.
Upvotes: 1
Views: 840
Reputation: 368
I guess this question is a bit old, but i just stumble upon trying to do the same and finding a solution. This is what i did
I hope it helps someone who is looking for the similar problem.
Upvotes: 1
Reputation: 4918
I have a feeling that working with LostFocus event can solve your problem.
Upvotes: 3