using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
namespace soundTest
{
public partial class Page : UserControl
{
MediaElement Btn;
public Page()
{
InitializeComponent();
LayoutRoot.Loaded += new RoutedEventHandler(LayoutRoot_Loaded);
}
void LayoutRoot_Loaded(object sender, RoutedEventArgs e)
{
Btn.MouseEnter += new MouseEventHandler(Btn_MouseEnter);
btnSound = new MediaElement();
btnSound.AutoPlay = false;
btnSound.Source = new Uri("http://localhost:49201/mouseOverSound.wma", UriKind.Absolute);
LayoutRoot.Children.Add(btnSound);
}
void Btn_MouseEnter(object sender, MouseEventArgs e)
{
btnSound.Stop();
btnSound.Play();
}
}
}