[ACCEPTED]-How to close WPF popup window?-wpf
you can try with
private void btnClosePopup_Click(object sender, RoutedEventArgs e)
{
popup.IsOpen = false;
}
0
If you would like to solve it in the XAML 4 code, here is a working solution (put the 3 Close button inside the popup):
<Button Name="CloseThisPopUp" VerticalAlignment="Top" HorizontalAlignment="Right" Content="X">
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<BooleanAnimationUsingKeyFrames Storyboard.TargetName="CloseThisPopUp" Storyboard.TargetProperty="IsOpen">
<DiscreteBooleanKeyFrame KeyTime="0:0:0" Value="False" />
</BooleanAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</Button.Triggers>
</Button>
You can also 2 use this code to open a popup, just change 1 the IsOpen property to "True".
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.