private void SwitchableMediaElement_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
 {
     if (!(bool)e.NewValue && SwitchableMediaElement.Source != null)
     {
         SwitchableMediaElement.Stop();
         SwitchableMediaElement.Source = null;
         SwitchableMediaElement.Close();
     }
 }
 private void SwitchableMediaElement_Unloaded(object sender, RoutedEventArgs e)
 {
     if (SwitchableMediaElement.Source != null)
     {
         SwitchableMediaElement.Stop();
         SwitchableMediaElement.Source = null;
         SwitchableMediaElement.Close();
     }
 }