2010-07-20 80 views

回答

3

如果你綁定到具有圖片URI和音頻剪輯URI的對象:

<Image Source="{Binding ImagePath}" Tag="{Binding AudioPath} MouseLeftButtonDown="img_MouseLeftButtonDown" /> 

然後在事件處理程序

void img_MouseLeftButtonDown(object sender,MouseButtonEventArgs e) 
    { 
Image img = sender as Image; 
if (img != null) 
mePlayer.Source = img.Tag as Uri; 
    } 
1

我不建議MediaElement的一個以上的音頻item ... it有奇怪的效果...使用類似於:

Stream stream = TitleContainer.OpenStream(@「Audio/buzzer.wav」);

 SoundEffect effect = SoundEffect.FromStream(stream); 
     FrameworkDispatcher.Update(); 
     effect.Play(); 

使用由XNA Framework ....