I got my UserControl that contain:
Button
Popup (contain Text block)
.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!
shreesh chandra shukla
19-Aug-2013You can use to ToggleButton instead of button it would easy.