I have a popup and I want to close it when I exit any point outside the popup. I searched, and everyone advised me to use the IsLightDismissEnabled property; however, if I touch outside, this will remove the popup, leaving everything inactive with a gray screen, as if it does not close the popup completely, this is my piece of code:
<Popup x:Name="logincontroler" IsOpen="False" Margin="0,190,896,276" IsLightDismissEnabled="True"> <StackPanel Height="300" Width="470" x:Name="popup" FlowDirection="RightToLeft"> <Grid Width="470" Background="White" > <Grid.RowDefinitions> <RowDefinition Height="70"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <RichEditBox Grid.Row="1" Height="250" TextWrapping="Wrap" FontSize="20" Name="notesPopupTextBox" FlowDirection="LeftToRight"/> <StackPanel Grid.Row="0" Orientation="Horizontal" Background="#FFE3E3E5"> <Button Name="CanclePopupButton" Content="Cancel" Width="64" Height="64" Click="CanclePopupButton_Click" /> <Button Name="ClearNotePopupButton" Content="Clear" Width="64" Height="64" Click="ClearNotePopupButton_Click" /> <Button Name="saveNoteButton" Content="Save" Width="64" Height="64" Click="saveNoteButton_Click" /> <TextBlock FontWeight="Medium" FontSize="40" Foreground="#2a2a86" Margin="170 12 0 0">Note</TextBlock> </StackPanel> </Grid> </StackPanel> </Popup>
this is my event code
private void ShowButton_Click(object sender, RoutedEventArgs e) { logincontroler.IsOpen = true; flipView1.IsEnabled = false; } private void CanclePopupButton_Click(object sender, RoutedEventArgs e) { logincontroler.IsOpen = false; flipView1.IsEnabled = true; }
Did I miss something? thanks in advance
source share