Google like SearchBox in Silverlight

I created Google as a SearchBox control in Silverlight. This means that when I enter into the field, the DropDownListBox appears just below the SearchBox, showing all the elements that match the text that I typed in the search bar so far (for example, the autocomplete function), exactly the same:

Google like SearchBox in Silverlight

Now I want to add functionality to it: I want DropDownListBox to disappear as soon as the user clicks on it or anywhere on the screen. I cannot process MouseLeftButtonDown(or any such event) in other controls to accomplish this, because users can click anywhere, including in the non-Silverlight region. Can someone suggest me what I have to do to achieve this?

So my question is basically this:

How do I know if a user has just been clicked and the click event occurred outside of a specific control?

Please note that AutoCompleteBoxdoes not serve my purpose. Therefore, I cannot use it.

+1
source share
2 answers

I have the feeling that working with LostFocus can solve your problem.

+3
source

I think this question is a little old, but I just stumble upon attempts to do the same and find a solution. This is what I did

  • Created a border with all fields -500, this will fully cover the entire screen.
  • The behavior of clicks on this border, the drop-down section of the SearchBox crashed.
  • z- SearchBox DropDown , SearchBox DropDown .
  • . , DropDown .

, -, .

+1

Source: https://habr.com/ru/post/1789204/


All Articles