With release of the v4.2.83 build of PowerShell Studio 2015, we introduced new features that we are covering in detail over a series of articles.
This next new feature was also added in response to user feedback. This particular user wanted to use the modern version of the folder browser dialog that is available in the later versions of Windows. Unfortunately, the user had to manually add code to the form to accomplish this. Therefore we added a new control to our toolbox:
FolderBrowserModernDialog
This control will display the modern version of the FolderBrowserDialog on Windows 7 or greater:
If running on a legacy OS, it will then display the original FolderBrowserDialog:
You can find the new control in the ToolBox Panel:
To add the dialog, simply drag and drop it into your existing form.
The new FolderBrowserModernDialog has the following properties:
This property sets the title of the folder browser dialog.
SelectedPath
This property sets the selected path of the dialog and returns the path the user selected.
Using the Dialog:
Here is an example of how to display the FolderBrowserModernDialog using its ShowDialog method:
$folderbrowsermoderndialog1.SelectedPath = $textboxPath.Text if ($folderbrowsermoderndialog1.ShowDialog() -eq 'OK') { $textboxPath.Text = $folderbrowsermoderndialog1.SelectedPath }
The modern versions of the FolderBrowserDialog makes for a better user experience and we hope that your GUI users agree.
RT @SAPIENTech: PowerShell Studio 2015 – New FolderBrowserModernDialog Control: With release of the v4.2.83 build of PowerShell… https://…
RT @SAPIENTech: PowerShell Studio 2015 – New FolderBrowserModernDialog Control: With release of the v4.2.83 build of PowerShell… https://…
It looks like you added my code from this post: https://www.sapien.com/forums/viewtopic.php?f=21&t=8662&p=46619&hilit=A+better+folderbrowserdialog#p46619.
I suppose that I should have mentioned that the initialization of the dialog also accepts InitialDirectory; I think it would be really useful if you added this to you new control as a property that can be set.
Regards,
Pete