Click here to Skip to main content
11,495,758 members (66,053 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C# Win8
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 5:20am
Edited 4-Oct-12 6: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
0 Dnyaneshwar@Pune 692
1 CHill60 318
2 Sascha Lefèvre 275
3 RyanDev 230
4 Sergey Alexandrovich Kryukov 210
0 Sergey Alexandrovich Kryukov 10,362
1 OriginalGriff 8,821
2 Sascha Lefèvre 3,899
3 Maciej Los 3,422
4 Richard Deeming 2,600

Advertise | Privacy | Mobile
Web04 | 2.8.150520.1 | Last Updated 5 Oct 2012
Copyright © CodeProject, 1999-2015
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