[英]Display Files and Folders on Gridview
I have files and folders on "koleksibuku" folder. 我在“ koleksibuku”文件夹中有文件和文件夹。 I want all the files and folders in the "koleksibuku" folder is displayed on the gridview.
我希望“ koleksibuku”文件夹中的所有文件和文件夹都显示在gridview上。 If the folder using images on: "ms-appx:///images/folders_png8761.png", whereas if the files using image bindings.
如果在文件夹上使用图像,则:“ ms-appx:///images/folders_png8761.png”,而如果文件使用图像绑定。 How do I display all the files and folders on a gridview?
如何在gridview上显示所有文件和文件夹?
Note: In the "koleksibuku" folder is not necessarily files and folders. 注意:“ koleksibuku”文件夹中不一定是文件和文件夹。 Folders created by the user with the folder name in accordance with the wishes of the user.
用户根据自己的意愿使用文件夹名称创建的文件夹。
Note: "koleksibuku" folder on local package 注意:本地软件包上的“ koleksibuku”文件夹
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
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.