---
title: "How to find out how a popup was closed"  
description: "How to find out how a popup was closed"  
author: "Hank Greenberg"  
published: 2013-08-09  
updated: 2013-08-10  
canonical: https://www.mindstick.com/forum/1364/how-to-find-out-how-a-popup-was-closed  
category: "wpf"  
tags: ["wpf"]  
reading_time: 1 minute  

---

# How to find out how a popup was closed

Hi [developers](https://www.mindstick.com/articles/12875/blunders-you-must-avoid-while-hiring-java-developers-to-get-the-best-fulfilling-your-needs)!

I have created a textbox with a button in it so it looks like a combobox. For the [dropdown menu](https://www.mindstick.com/forum/158697/how-can-implement-a-dropdown-menu-or-navigation-bar-with-hover-effects-using-jquery) I use a popup. I did this because I have a [treeview](https://www.mindstick.com/forum/1180/how-to-create-a-treeview-from-xml-file-in-c-sharp) inside the dropdown menu and a small [summary](https://www.mindstick.com/forum/33860/how-to-calculate-column-summary-in-sql-server) of what is selected in the treeview as the SelectedItem.

Here is my [problem](https://yourviews.mindstick.com/view/81399/tackling-the-problem-of-unemployment-during-corona-pandemic): When I click the button when the popup is open it closes the popup first and then due to the button's [click event](https://www.mindstick.com/forum/424/how-to-call-form_paint-event-on-button-click-event) the popup opens up again and I want to prevent this behavior.

\
My idea for the solution is to have a bool [variable](https://www.mindstick.com/articles/1807/objective-c-data-types-variables-object-creation) which is set true when the popup is closed because one clicked the button and the [button click](https://www.mindstick.com/forum/790/form-gets-submiited-twice-on-button-click) event only opens the popup when the variable is false. But this only applies when you know exactly you didn't click anywhere else.

Has somebody a solution for this problem?

Thank in [advance](https://www.mindstick.com/blog/33258/jee-mains-and-jee-advance-exams)

## Replies

### Reply by Pravesh Singh

You can solve this problem by setting the button's IsEnabled to false when the popup is opened and setting it back to true when the popup's Closed-Event is called.


---

Original Source: https://www.mindstick.com/forum/1364/how-to-find-out-how-a-popup-was-closed

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
