This is a demonstration project that shows three different folder selectors implemented as wpf user controls.
These are folder selectors designed to integrate with WPF projects that use the Model View View-Model (MVVM) design pattern.
The first control, shown here on the left, allows the user to drag-drop the desired folder. To be consistent with the MVVM pattern, the drop event is converted into a command using 'attached behaviour'. This code leverages off an article appearing at http://www.wpfsharp.com/2012/03/22/mvvm-and-drag-and-drop-command-binding-with-an-attached-behavior/
. The control itself uses a rigorously compliant 'view model' approach so as to integrate with a larger MVVM project.
The second control, shown here in the middle with the heading 'Multi Directory Selector', allows the user to select multiple folders. Each folder is presented with a check box for selection or deselection. The list is bound to a collection of bespoke objects in the view model. The control itself uses a rigorously compliant 'view model' approach so as to integrate with a larger MVVM project.
The third control, shown on the right, is a more traditional folder browser and selector. It is a wpf list box which is populated with standard C# DirectoryInfo objects. The user is meant to navigate to the desired folder by double clicking the relevant list box items. In order to be compliant with MVVM principles, the double click event is translated into a command using an 'attached behaviour'. The control itself uses a rigorously compliant 'view model' approach so as to integrate with a larger MVVM project.
Commanding is done using the Relay Command class http://msdn.microsoft.com/en-us/magazine/dd419663.aspx
which is implemented in its own assembly. This class can be easily substituted for Prism's 'Delegate Command' class.
The application itself has no other purpose than to show these controls.