在Windows 8中显示文档库文件夹 [英] display documentlibrary folders in windows 8

查看:75
本文介绍了在Windows 8中显示文档库文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在获取文档库文件夹.但我不知道如何在MainPage.Xaml设计页面中显示geeting文件夹.

这是我的代码:

i''m getting the documentlibrary folders. but i don''t know how to display the geeting folders in a MainPage.Xaml design page.

here is my code:

var folders = await KnownFolders.DocumentsLibrary.GetFoldersAsync();


如果有人指导我.预先感谢.


if anyone guide me. Thanks in advance.

推荐答案

<grid grid.row="1">
            <grid.rowdefinitions>
                <rowdefinition height="Auto"></rowdefinition>
                <rowdefinition height="Auto"></rowdefinition>
            </grid.rowdefinitions>
                    <listview x:name="FolderList" horizontalalignment="Left" height="Auto" margin="125,30,0,0" verticalalignment="Top" width="250" removed="#FF636E5D" xmlns:x="#unknown">
                <listview.itemtemplate>
                            <datatemplate>
                                <textblock text="{Binding DisplayName}"></textblock>
                            </datatemplate>
                        </listview.itemtemplate>
                    </listview>         
        </grid>


现在,在后面的代码中编写以下代码:


Now, in code behind write following code:

protected async override void LoadState(Object navigationParameter, Dictionary<string,> pageState)
        {
            var folders = await Windows.Storage.KnownFolders.DocumentsLibrary.GetFoldersAsync();
            var data = folders.ToList<windows.storage.storagefolder>();
            FolderList.ItemsSource = data;
        }


这将在ListView中显示DocumentsLibrary中的所有文件夹.


This will show all the folders within the DocumentsLibrary in ListView.


使用GetFilesAsync()检索文件夹中的文件,然后对于每个检索到的项目,显示其Path属性(假设"就是您要显示的内容.

/ravi
Use GetFilesAsync() to retrieve the files in the folder, then for each retrieved item, display its Path property (assuming that''s what you want to display).

/ravi


这篇关于在Windows 8中显示文档库文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆