title: WPF C# User control page IsVisibleChanged event
body: <p>i have some user control page , and a MainWindow , so i would like to set user control page to hidden , and once its hidden , it stops its audio from playing </p>
  
  <p>i know i have to do something with IsVisibleChanged event but i got stuck at how to start it?</p>
  
  <p>Is it something like this ? </p>
  
  <pre><code>(pagename).IsVisibleChanged(object sender , RoutedEventArgs e )
   {    ap.Stop()  }
  </code></pre>
  
  <p>Because my user control page ( i display it within the mainwindow using a custom control ) is in my mainwindow and the user control page have some audio playing , when i click the home button that resides on the mainwindow , i'll set the user control page to hidden and show my home page , but now when it is hidden , the audio from that page is still playing , so i went to ask and some said use IsVisibleChanged event in user control page ( the 1 that plays the audio ) but i got stuck at how do i even write it cos i am new to this . </p>