注册 登录
编程论坛 WPF/Silverlight

WPF多媒体播放器无添加文件

懂也不懂 发布于 2010-12-13 22:46, 1923 次点击
为什么,打开的
只有本站会员才能查看附件,请 登录
中没有MP3文件可以添加,“我的音乐”里面确实是有MP3文件的??!!

 private void openBtn_Click(object sender, RoutedEventArgs e)
        {
            ShellContainer selectedFolder = null;
            selectedFolder = KnownFolders.Music as ShellContainer;
            CommonOpenFileDialog cfd = new CommonOpenFileDialog();
            cfd.InitialDirectoryShellContainer = selectedFolder;
            cfd.EnsureReadOnly = false;
            cfd.Filters.Add(new CommonFileDialogFilter("WMV Files", "*.wmv"));
            cfd.Filters.Add(new CommonFileDialogFilter("AVI Files", "*.AVI"));
            cfd.Filters.Add(new CommonFileDialogFilter("MP3 Files", "*.MP3"));

            if (cfd.ShowDialog() == CommonFileDialogResult.OK)
            {
                mediaElement.Source = new Uri(cfd.FileName, UriKind.Relative);
                playBtn.IsEnabled = true;
            }
        }
1 回复
#2
懂也不懂2010-12-14 19:55
犯了一个不该犯的错误,不说是什么了,代码也没错,什么都没错,哈哈哈!是无意间发现的
1