Click here to Skip to main content
Rate this: bad
good
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 4:20am
Edited 4-Oct-12 5:06am
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

<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;
        }
This will show all the folders within the DocumentsLibrary in ListView.
  Permalink  
v2
Rate this: bad
good
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).
 
/ravi
  Permalink  

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 372
1 OriginalGriff 295
2 thatraja 215
3 Emre Ataseven 155
4 Shai Vashdi 125
0 Sergey Alexandrovich Kryukov 8,849
1 OriginalGriff 5,035
2 Peter Leow 3,949
3 Maciej Los 3,535
4 Abhinav S 3,148


Advertise | Privacy | Mobile
Web03 | 2.8.140415.2 | Last Updated 5 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid