I have used an expander control to create some sort of slide-out panel which holds some filtering options. The users have the option to ‘pin’ this expander to the view. All went well but now I would like to know how I can get the expander to auto close when the user clicks somewhere out of the expander. I tried the LostFocus and several other events but to no avail. Which event can inform me when the user has clicked somewhere else?
(For the moment I’m just using a timer which closes the expander after +- 2 seconds after the mouse left the expander but I would prefer the other solution)
Thanks in advance.
Assuming your
Expanderis named “yourExpander” you could do this:If
e.OriginalSourceis not a descendant of your expander close your expander: