How to create a datagrid with wav-files in WPF

半腔热情 提交于 2019-12-11 17:36:28

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!