locked
About FileInformationFactory RRS feed

  • Question

  • Hi all,

       

    FileInformationFactory.GetVirtualizedFilesVector() can be bond to GridView, but it can only bond one folder. I want to bond two folder to one GridView, how can I do?

    Sunday, June 9, 2013 3:34 AM

Answers

  • Here is dummy(just modified DataSourceAdapter sample) example- 

    var queryOptions = new QueryOptions();
                queryOptions.FolderDepth = FolderDepth.Deep;
                queryOptions.IndexerOption = IndexerOption.UseIndexerWhenAvailable;
                queryOptions.SortOrder.Clear();
                var sortEntry = new SortEntry();
                sortEntry.PropertyName = "System.FileName";
                sortEntry.AscendingOrder = true;
                queryOptions.SortOrder.Add(sortEntry);
    
                var fileQuery = KnownFolders.PicturesLibrary.CreateFileQueryWithOptions(queryOptions);
               
                const uint size = 190; // default size for PicturesView mode
                var fileInformationFactory = new FileInformationFactory(fileQuery, ThumbnailMode.PicturesView, size, ThumbnailOptions.UseCurrentScale, true);
                IReadOnlyList<FileInformation> lstFileInformation = await fileInformationFactory.GetFilesAsync();
                IReadOnlyList<FileInformation> lstlstFileInformation2 = await fileInformationFactory.GetFilesAsync(); //Dummy list
                List<FileInformation> lstFileCombined = new List<FileInformation>(lstFileInformation);
                lstFileCombined.AddRange(lstlstFileInformation2);
                itemsViewSource.Source = lstFileCombined;

    example 


    Thanks,
    Sachin
    My Samples


    Tuesday, June 11, 2013 3:34 AM

All replies

  • It is not possible to get the information out of  GetVirtualizedFilesVector as it returns object (also it is virtualized) not collection. If subfolder is inside main folder we can set  the FolderDepth to true.  I think you can use GetFilesAsync and enumerate over the collection.


    Thanks,
    Sachin
    My Samples

    Sunday, June 9, 2013 4:26 AM
  • Hi Sachin,

       "I think you can use GetFilesAsync and enumerate over the collection" , How to do it, can you give me a sample

    Sunday, June 9, 2013 6:05 AM
  • Here is dummy(just modified DataSourceAdapter sample) example- 

    var queryOptions = new QueryOptions();
                queryOptions.FolderDepth = FolderDepth.Deep;
                queryOptions.IndexerOption = IndexerOption.UseIndexerWhenAvailable;
                queryOptions.SortOrder.Clear();
                var sortEntry = new SortEntry();
                sortEntry.PropertyName = "System.FileName";
                sortEntry.AscendingOrder = true;
                queryOptions.SortOrder.Add(sortEntry);
    
                var fileQuery = KnownFolders.PicturesLibrary.CreateFileQueryWithOptions(queryOptions);
               
                const uint size = 190; // default size for PicturesView mode
                var fileInformationFactory = new FileInformationFactory(fileQuery, ThumbnailMode.PicturesView, size, ThumbnailOptions.UseCurrentScale, true);
                IReadOnlyList<FileInformation> lstFileInformation = await fileInformationFactory.GetFilesAsync();
                IReadOnlyList<FileInformation> lstlstFileInformation2 = await fileInformationFactory.GetFilesAsync(); //Dummy list
                List<FileInformation> lstFileCombined = new List<FileInformation>(lstFileInformation);
                lstFileCombined.AddRange(lstlstFileInformation2);
                itemsViewSource.Source = lstFileCombined;

    example 


    Thanks,
    Sachin
    My Samples


    Tuesday, June 11, 2013 3:34 AM