4

I have a popup which contains multiple elements, a list view, a text box and a button. These are operating fine, and if you use the button to close the popup it works as well, but when i tried to make the popup close when it lost focus, it closed when i clicked an element in the listview. Is there any way around this? Is the FocusManager property the way to go?

wonea
  • 4,783
  • 17
  • 86
  • 139
TerrorAustralis
  • 2,833
  • 6
  • 32
  • 46

3 Answers3

2

Please try the stayopen property of the popup control in you code. If it is not working please post your code.

wonea
  • 4,783
  • 17
  • 86
  • 139
Geeth
  • 5,282
  • 21
  • 82
  • 133
  • StaysOpen is dependent on focus, its really just a re-implementation of what i have already done. The code is pretty dependent, working on a sample app – TerrorAustralis Aug 16 '10 at 02:05
2

Set FocusManager.IsFocusScope = True on your Popup element, so it keep focus as long as one of his children has it.

Micael Bergeron
  • 1,154
  • 7
  • 13
  • If i set the focusmanager.IsFocusScope to true, the popup never closes. This confused me... I thought that since the popup was part of a data template maybe it thought the entire application was its child :P – TerrorAustralis Aug 16 '10 at 02:06
  • @micael Bergerron FocusManager.IsFocusScope="true" is done then also it gets closed. My popup control contains one user control which contains AutoCompleteBox having dropdown behaviour. If I select any element from dropdown the popup gets closed – Mohini Mhetre Feb 22 '16 at 06:24
1

You should just set the StaysOpen property on your popup like this:

<Popup StaysOpen="True">
...
</Popup>

http://msdn.microsoft.com/en-us/library/system.windows.controls.primitives.popup.staysopen.aspx

Louis Duran
  • 144
  • 1
  • 12