Santosh Santosh - 1 year ago 381
C# Question

How to close WPF popup window?

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" >
<RowDefinition Height="0.488*"/>
<RowDefinition Height="0.512*"/>

<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"
<ImageBrush ImageSource="Image/1329666144_button_cancel.png" Stretch="UniformToFill"/>

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...

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download