HOW TO FIND OUT HOW A POPUP WAS CLOSED

Hank Greenberg

Total Post:12

Points:84
Posted by  Hank Greenberg
WPF 
WPF
 1040  View(s)
Ratings:
Rate this:
Hi developers!

I have created a textbox with a button in it so it looks like a combobox. For the dropdown menu I use a popup. I did this because I have a treeview inside the dropdown menu and a small summary of what is selected in the treeview as the SelectedItem.

Here is my problem: When I click the button when the popup is open it closes the popup first and then due to the button's 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 which is set true when the popup is closed because one clicked the button and the 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

  1. Pravesh Singh

    Post:412

    Points:2888
    Re: How to find out how a popup was closed

    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.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!