Click here to Skip to main content
Click here to Skip to main content

File and Folder ListView

, 4 May 2012
Rate this:
Please Sign up or sign in to vote.
File and Folder Listview is a simple component that I made as an alternative to OpenFileDialog or CommonOpenFileDialog that does not support selecting both File or Folder.

 

Introduction

File and Folder Listview is a simple component that I made as an alternative to OpenFileDialog or CommonOpenFileDialog that does not support selecting both File or Folder.

In the standard controls, we use OpenFileDialog to select Files and we use FolderDialog to select Folders. Other common controls released by Microsoft was the CommonOpenFileDialog available in WindowsAPICodePack. The UI looks like the standard OpenFileDialog but it can also select Folders if "IsFolderPicker" property is set to true. But one thing these standard controls cannot do is to the ability to select both File or Folder 

Using the code

In your project, add FileFolderList.cs and drag the control in your form or in any container. FileFolderList is using ListView as it's base class so all the properties, method, and events of the ListView are available.

FileFolderList has 3 custom properties

  • string DefaultPath {get;set;}
  • string SelectedPath {get;}
  • bool isSoloBrowser {get;set;}
    // - when true, it will add "..." so you can go back to the parent folder

and 2 custom methods

  • void Load()
    call this method when your form has loaded 
  • void Browse(string path)  

Adding the control programatically can be done in this way

GCS.Windows.Forms.FileFolderList ffl = new GCS.Windows.Forms.FileFolderList();
ffl.View = View.Details;
ffl.Load();
ffl.Dock = DockStyle.Fill;
this.Controls.Add(ffl); 

Points of Interest

FileFolderList uses BackgroundWorker object to load the associated icons in a separate thread. 

History

this is my initial release 

License

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

Share

About the Author

Jayson Ragasa
Founder Capploud
Philippines Philippines
I am an experienced Applications Developer and had worked professionally for over 6 years. I have been writing codes and building different applications for over 13+ years. My work is mostly for Microsoft technologies such as .NET. Yes I am Microsoft technology enthusiast.
 
My field of expertise in .NET technology are Desktop and Windows Mobile and Windows Phone. I occasionally write ASP.NET too for clients.
 
I have wide experience of different programming languages and scripts such as: Turbo Pascal, Batch Scripts, C/C++, Visual Basic Classic, Visual Basic .NET, Java, HTML, CSS, ASP Classic, VB Script, ASP.NET, T-SQL, MySQL, PHP, C#, Javascript, jQuery, HTML5, RegEx, XAML, XML, JSON, and XPath
 
I am also experienced in different platforms such as: Google Data API, Google Map API, Twitter API, Facebook API, Flickr API, Skydrive API, SVN, GitHub, Drupal, and Orchard.
 
I am interested in Microsoft technologies, User Experience and User Interfaces, Algorithms, Robotics, Astronomy, Architecture, Electrical, Mechanics, and Extra Therestrial Life on other planets.
 
I am also offering free coding and application development consultations with students having a problem with their Thesis projects.
 
View my full Curriculum Vitae here
http://ss.jaysonragasa.net/?mycv
Follow on   Twitter

Comments and Discussions

 
GeneralMy vote of 5 Pinmembertreesprite18-Jul-14 14:33 
QuestionFiltering Suggestion? Pinmembertreesprite18-Jul-14 14:30 
GeneralMy vote of 3 Pinmembervaivit24-Jun-14 21:16 
Questionimplement a save function... [modified] Pinmembertreesprite6-Feb-13 12:24 
Nice...

modified 12-Feb-13 12:47pm.

AnswerRe: implement a save function... PinmemberJayson Ragasa6-Feb-13 12:26 
QuestionImages PinmvpMehdi Gholam3-May-12 19:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web02 | 2.8.140827.1 | Last Updated 4 May 2012
Article Copyright 2012 by Jayson Ragasa
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid