Click here to Skip to main content
13,046,499 members (71,991 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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.
Posted 4-Oct-12 4:20am
Updated 4-Oct-12 5:06am
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

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

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<>();
            FolderList.ItemsSource = data;

This will show all the folders within the DocumentsLibrary in ListView.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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).


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 5 Oct 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100