简体   繁体   中英

How to create a datagrid with wav-files in WPF

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");
   }
}

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM