构建Windows Phone媒体应用:从视频播放器到音效机器人
1. 构建MediaPlayerDemo应用
1.1 创建项目
要创建MediaPlayerDemo项目,可按以下步骤操作:
1. 打开工作站上的Microsoft Visual Studio 2010 Express for Windows Phone。
2. 从Visual Studio命令菜单中选择“文件” -> “新建项目”。
3. 选择Windows Phone应用程序模板,将应用程序命名为MediaPlayerDemo,然后点击“确定”。
1.2 构建UI
在Visual Studio中使用XAML构建UI,这在构建简单控件时非常方便。具体步骤如下:
1. 打开解决方案资源管理器,找到并打开MainPage.xaml文件。
2. 用以下代码片段替换其中的XAML代码。
声明UI资源
以下是声明UI资源的代码,这些命名空间在创建Windows Phone项目时通常会默认声明:
<phone:PhoneApplicationPage x:Class="MediaPlayerDemo.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:phon