views:

255

answers:

1

Imagine the situation you open a WPF Popup(e.g. through ButtonClick). You have a ListBox directly in the Popup with some items, so you have to be able to scroll. Imagine that this is your Custom Control and it's located in the ScrollViewer.

Now if you move with your mouse outside from the Popup surface and scroll, what happens? You scroll up and down but with the Popup opened ! And that's the problem.

The question is, how to detect from inside the Control, that some other unknown Parent Control in the VisualTree has started to scroll ? and consecutively set IsDropDownOpen = false?

A: 

I don't quite picture how your controls are, but can't you base your opening/closing of a control on the Focus event? And if it loses focus, to close the popup? Maybe I understand wrong, can you post a code snippet? Daniel

daniell