简体   繁体   中英

Display Files and Folders on Gridview

I have files and folders on "koleksibuku" folder. I want all the files and folders in the "koleksibuku" folder is displayed on the gridview. If the folder using images on: "ms-appx:///images/folders_png8761.png", whereas if the files using image bindings. How do I display all the files and folders on a gridview?

Note: In the "koleksibuku" folder is not necessarily files and folders. Folders created by the user with the folder name in accordance with the wishes of the user.

Note: "koleksibuku" folder on local package

I won't go into details, just a hint:

var gridViewItems = gridView.Items;

var folder = await ApplicationData.LocalFolder.GetFolderAsync("kolesibuku");
foreach (var item in await folder.GetItemsAsync()) {
    if (item.IsOfType(StorageItemType.Folder))
        processFolder(gridViewItems, (StorageFolder) item); // Add folder element to gridView
    else if (item.IsOfType(StorageItemType.File))
        processFile(gridViewItems, (StorageFile) item); // Add file element to gridView
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM