I
I
Igor Mamushin2015-10-09 11:15:35
.NET
Igor Mamushin, 2015-10-09 11:15:35

How to hide an element when clicked outside of it C#?

There is a certain element that can "Collapse" when moving to another element (losing focus), however, when you click in the program window, the focus is not lost, respectively, the element is not collapsed. How to make it so that when you click in any area of ​​the program, this element is minimized?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
Tsiren Naimanov, 2015-10-09
@ImmortalCAT

look for events with the word Focus / OverFocus etc

E
eRKa, 2015-10-10
@kttotto

You handle the mouse click event, you look at which object the click occurred. If it's not your object, then you collapse it. Usually, when you click the mouse, the focus will go to the object under the cursor, you can check the focus on your object.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question