Home > DeveloperSection > Forums > Popup does not closed event Stayopen set as False
Chintoo Semi

Total Post:135

Points:947
Posted on    January-29-2014 11:18 PM

 C# C# 
Ratings:


 1 Reply(s)
 591  View(s)
Rate this:

I have use the following code snippet to define the Popup.

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.

Actual Behavior:

Popup does not close.

Expected Behavior:

Popup should be closed.

Thanks in advance.



Pravesh Singh

Total Post:411

Points:2881
Posted on    January-29-2014 11:43 PM

Hi Chintoo,

Try this:

FilterPanel.IsMouseCaptureWithinChanged +=FilterPanel_IsMouseCaptureWithinChanged;

void FilterPanel_IsMouseCaptureWithinChanged(object sender, DependencyPropertyChangedEventArgs e)

    {

        if (!(bool)e.NewValue)

        { FilterPanel.IsOpen = false; }

    }


Don't want to miss updates? Please click the below button!

Follow MindStick