WPF多媒体播放器无添加文件
为什么,打开的
中没有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;
}
}