在隔离存储窗口phone 7中检索指定文件夹的文件名

时间:2011-07-19 01:06:57

标签: windows-phone-7 isolatedstorage

我正在尝试检索“ScheduleFolder”下的所有文件名并将其放入列表框中。 我应该怎么做呢? 如何让它显示在scheduleListBox中?

       IsolatedStorageFile myStore = IsolatedStorageFile.GetUserStoreForApplication();
       string[] fileNames = myStore.GetFileNames("./ScheduleFolder/*.*");

        foreach (string name1 in fileNames)
        {
           yo = fileNames[0];
        }
        scheduleListBox.Items.Add(yo);
        textBlock1.Text = yo;

2 个答案:

答案 0 :(得分:1)

试试这个代码段

IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication();
string[] fileNames = isf.GetFileNames("./DirectoryName/*.*");

答案 1 :(得分:0)

我可能会用这个......

IsolatedStorageFile myStore = IsolatedStorageFile.GetUserStoreForApplication();
string[] fileNames = myStore.GetFileNames("./ScheduleFolder/*.*");
scheduleListBox.ItemsSource = fileNames;