How to create a datagrid with wav-files in WPF

2019-09-02 15:07发布

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条回答
祖国的老花朵
2楼-- · 2019-09-02 15:29

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.

查看更多
登录 后发表回答