I got my UserControl that contain:
.XAML file
<UserControl>
<button Name="btnShowPopup" Content="Button" Click=" btnShowPopup _Click"/>
<Popup Name="popup" StaysOpen="true">
<TextBlock Text="Popup"/>
</Popup>
</UserControl>
Code Behide
private void btnShowPopup _Click(object sender, System.Windows.RoutedEventArgs e)
{
this.popup.IsOpen=!this.popup.IsOpen;
}
QUESTION: I want to hide the popup, when mouse click on anywhere outside the btnShowPopup button.
please help me. thank in advance!
You can use to ToggleButton instead of button it would easy.