如何在WPF中使用WAV文件创建数据网格 [英] How to create a datagrid with wav-files in WPF

查看:77
本文介绍了如何在WPF中使用WAV文件创建数据网格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望有人能帮助我.我想为我的对象列表中的每个对象添加一个wav文件.该类绑定到ObservableCollection.但是我想知道使用SoundPlayer从数据网格读取和播放这些wav文件的最简单方法吗?

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

推荐答案

您可以使用您应该将MediaElement的Source属性绑定到wav文件(CoSound?).

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.

这篇关于如何在WPF中使用WAV文件创建数据网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆