问题
I hope somebody could help me. I want to add a wav-file for every object in my objectlist. The class is bound to an ObservableCollection. But I want to know the easiest way to read and play these wav-files from a datagrid using SoundPlayer?
public string CoName
{
get { return coName; }
set
{
coName = value;
Changed("CoName");
}
}
public byte[] CoSound
{
get { return coSound; }
set
{
coSound = value;
Changed("CoSound");
}
}
回答1:
You could use MediaElement.
You should bind the Source property of MediaElement to the wav file (CoSound?).
You should also define the style of the datagrid so that the column you want to put the sound on.
来源:https://stackoverflow.com/questions/6828100/how-to-create-a-datagrid-with-wav-files-in-wpf