Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to close WPF popup window?

Tags:

c#

wpf

I am developing project in WPF and I am facing a problem using a popup window in my project. I use popup control in my window as shown below:-

<Popup HorizontalAlignment="Center" VerticalAlignment="Center" 
    AllowsTransparency="True" x:Name="popup" Placement="Center" 
    OpacityMask="#FFC86E6E" Closed="popup_Closed" >
    <Grid Height="auto" Width="auto" Margin="0" >
        <Grid.RowDefinitions>
            <RowDefinition Height="0.488*"/>
            <RowDefinition Height="0.512*"/>
        </Grid.RowDefinitions>

        <Frame x:Name="popupframe" Margin="0" Grid.Row="1"  />
        <Button Width="30" Height="30"  HorizontalAlignment="Right" 
                            Margin="0,0,10,-50" VerticalAlignment="Center" 
                            BorderThickness="0" BorderBrush="{x:Null}" 
                            ClickMode="Press" Click="Button_Click" 
                            Foreground="{x:Null}">
            <Button.Background>
                <ImageBrush ImageSource="Image/1329666144_button_cancel.png" Stretch="UniformToFill"/>
            </Button.Background>
        </Button>
            </Grid>
</Popup>

Now i Create new page in wpf with textbox and button and set this page to popup frame show below:-

popupframe.Content=new SessionObjection();

Now i want to close popup window with page button. How i do...

like image 759
Santosh Avatar asked Aug 18 '12 12:08

Santosh


People also ask

How to close Popup window in WPF c#?

You could set StaysOpen="False", and " IsOpen="False"" in C# code to close your Popup. Please remember to mark the replies as answers if they help and unmark them if they provide no help.

How do I close a WPF window?

Pressing ALT + F4 . Pressing the Close button.

How to close Pop up in c#?

GetType(), "onclick", "window. close()", true);


1 Answers

You can close the popup by setting the IsOpen property to false.

like image 196
Peter Lillevold Avatar answered Sep 30 '22 07:09

Peter Lillevold