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.