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