Click here to Skip to main content
Click here to Skip to main content
Alternative Article

WPF Folder Browser

, 26 Apr 2012 CPOL
Rate this:
Please Sign up or sign in to vote.
This is an alternative for "WPF Folder Browser"

Introduction

This version of the WPF Folder Browser introduces new basic functionality.

It offers

  • Automatic treeview folder opening and scrolling when the SelectedFolder is changed programmatically or via user input in the text box.
  • Update of SelectedFolder on enterkey down.  
  • Selection on double click. 

Background 

Sean Ireson liked the original solution so much that he went through the hassle of improving it and offer the code to the original poster for updating. Years later he was kind enough to email me his new code base to save me some time. Now I've made another tiny update which I think makes it worth to reshare.

Using the code

The changes to the original code done by Sean:

  • Introduction of the TreeViewItemBehaviour class introducing the DependencyProperty IsBroughtIntoViewWhenSelected
  • Modification to the BrowserViewModel by introducing the OnSelectedFolderChanged and Expand functions.
  • Addition of a text_box click event that selects and closes the form on double click on either text or treeview node.
  • I added the InputBindingManager class blatantly stolen from this StackOverflow answer by Samuel Jack. This enables the textbox to update the binding on enter key down events by creating an attached behaviour to the textbox in the XAML code. 

Points of Interest

The Attached Behavior is quite practical for use on templated controls.

History

Nothing so far.

License

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

Share

About the Author

Erik Rude
Software Developer
United Kingdom United Kingdom
No Biography provided

Comments and Discussions

 
GeneralMy vote of 3 PinmemberClaire Streb15-May-12 11:43 

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 | Terms of Use | Mobile
Web02 | 2.8.1411023.1 | Last Updated 26 Apr 2012
Article Copyright 2012 by Erik Rude
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid