[英]Detect Folders or Files on Gridview on UWP
I have files and folders in the "koleksibuku" folder. 我在“ koleksibuku”文件夹中有文件和文件夹。 I want to show folders and files into the gridview.
我想将文件夹和文件显示到gridview中。 How do I detect whether in the "koleksibuku" folder there are folders or files?
如何检测“ koleksibuku”文件夹中是否有文件夹或文件?
Note: 注意:
When a folder using the image:"ms-appx:///images/folders_png8761.png" 当文件夹使用图像时:“ ms-appx:///images/folders_png8761.png”
When a file using data binding 当文件使用数据绑定时
Folder created by the user with the folder name in accordance with the wishes of the user 用户创建的文件夹,其文件夹名称符合用户的意愿
You can get a list of subfolders by calling GetFoldersAsync()
on a StorageFolder
. 您可以通过在
StorageFolder
上调用GetFoldersAsync()
来获取子文件夹列表。
Here's how to use it to get a list of folders from the music folder (requires "Music Library" capability). 这是使用它从音乐文件夹中获取文件夹列表的方法(需要“音乐库”功能)。
var downloadsFolder = Windows.Storage.KnownFolders.MusicLibrary;
foreach (var folder in await downloadsFolder.GetFoldersAsync())
{
Debug.WriteLine($"Folder: {folder.DisplayName}");
}
Assuming you've created your "koleksibuku" folder in your apps local folder you would get it with something like this. 假设您已在应用程序本地文件夹中创建了“ koleksibuku”文件夹,则将获得类似以下内容的文件夹。
var localFolder = Windows.Storage.ApplicationData.Current.LocalFolder;
var myFolder = await localFolder.GetFolderAsync("koleksibuku");
myFolder.GetFoldersAsync();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.