Popup.StaysOpen Property

Gets or sets whether the Popup control closes when the control is no longer in focus.

Namespace: System.Windows.Controls.Primitives
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

public bool StaysOpen { get; set; }
/** @property */
public boolean get_StaysOpen ()

/** @property */
public void set_StaysOpen (boolean value)

public function get StaysOpen () : boolean

public function set StaysOpen (value : boolean)

<object StaysOpen="bool" .../>

Property Value

true if the Popup control closes when the control is no longer in focus; otherwise, false. The default value is true.

Identifier field


Metadata properties set to true


By default, a Popup stays open until it is explicitly closed by setting the IsOpen property to false. However, when the StaysOpen property is set to false, the Popup control intercepts all mouse and keyboard events and closes when one of these events occurs outside the Popup window.

The following example shows how to set the StaysOpen property.

<DockPanel  Width="500" Background="Aqua">
  <Popup Placement="Center" PlacementRectangle="0,0,30,50"  
          IsOpen ="True" StaysOpen="True"
    <TextBlock Background="Purple">Popup Text</TextBlock>

myTextBlockPopup.StaysOpen = true;

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions