---
title: "Popup does not closed event Stayopen set as False"  
description: "Popup does not closed event Stayopen set as False"  
author: "Anonymous User"  
published: 2014-01-29  
updated: 2014-01-29  
canonical: https://www.mindstick.com/forum/1909/popup-does-not-closed-event-stayopen-set-as-false  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# Popup does not closed event Stayopen set as False

I have use the following [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii) snippet to [define](https://yourviews.mindstick.com/audio/1110/lifestyles-choices-that-define-our-lives) the [Popup](https://www.mindstick.com/blog/11734/how-to-create-advanced-popup-or-banners-with-news-images-discounts-in-magento2).

## XAML:

```
  <Grid Margin="0,0,0,0"  Height="40">          <Grid.ColumnDefinitions>      <ColumnDefinition Width="Auto" />      <ColumnDefinition Width="19" />      <ColumnDefinition Width="19" />    </Grid.ColumnDefinitions>    <TextBlock HorizontalAlignment="Stretch"               Text="HeaderText"                                       FontWeight="Bold"               TextTrimming="CharacterEllipsis"               VerticalAlignment="Center"/>       <Grid Grid.Column="1">         <Button Width="19" x:Name="FilterButton" Click="FilterButton_OnClick" Content="^"/>         <Popup x:Name="FilterPanel" StaysOpen="False"   >           <Border >             <Grid>               <TextBlock x:Name="tblTitle" Text="PopUp Header" Background="Red" Grid.Column="0" Grid.Row="0"/>             </Grid>           </Border>         </Popup>       </Grid>    <TextBox Text="Test" Grid.Column="2"/>  </Grid>
```

I have use the following code snippet to open the popup

## C#:

```
private void FilterButton_OnClick(object sender, RoutedEventArgs e){     this.FilterPanel.IsOpen = true;}
```

## Scenorio:

Open the popup using [button click](https://www.mindstick.com/forum/790/form-gets-submiited-twice-on-button-click).

Actual [Behavior](https://www.mindstick.com/forum/159354/runtimeexception-and-exception-behavior):

Popup does not close.

Expected Behavior:

Popup should be closed.

Thanks in advance.

## Replies

### Reply by Pravesh Singh

Hi Chintoo,\
Try this:\

```
FilterPanel.IsMouseCaptureWithinChanged
+=FilterPanel_IsMouseCaptureWithinChanged;void FilterPanel_IsMouseCaptureWithinChanged(object sender,
DependencyPropertyChangedEventArgs e)    {        if
(!(bool)e.NewValue)        {
FilterPanel.IsOpen = false; }     }
```


---

Original Source: https://www.mindstick.com/forum/1909/popup-does-not-closed-event-stayopen-set-as-false

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
