在 Windows Phone 7 中添加媒体元素? [英] adding media element in windows phone 7?

查看:22
本文介绍了在 Windows Phone 7 中添加媒体元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在每次点击时播放图像的音频.如果我们点击另一个图像,声音将以这种方式播放,我们想要编写逻辑.

I want to play an audio of an image whenever click on it .If we click on another image that sound will play in that way we want write the logic.

推荐答案

如果您要绑定到具有图像 uri 和音频剪辑 uri 的对象:

If you're binding to an object that has the image uri and audio clip uri:

<Image Source="{Binding ImagePath}" Tag="{Binding AudioPath} MouseLeftButtonDown="img_MouseLeftButtonDown" />

然后在事件处理程序中

    void img_MouseLeftButtonDown(object sender,MouseButtonEventArgs e)
    {
Image img = sender as Image;
if (img != null)
mePlayer.Source = img.Tag as Uri;
    }

这篇关于在 Windows Phone 7 中添加媒体元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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