I am trying to disable/hide the "Network" folder when calling the SaveFileDialog in C# WPF and from everything that I've read on SO/Google, there is no way to customize/hide/disable the Navigation Pane at all.
However, I've stumble upon an option in "Folder Options > Show Network", which allows me to hide the "Network" link in the Navigation Pane. Does anyone know which registry key I need to use to toggle it? My plan is to programmatically set the flag to 0 before I show the dialog and restore it back to its original state when I finish.
I've dig through the following resources (and more) but can't find what I need:
- https://ss64.com/nt/syntax-reghacks.html
- Remove places bar in OpenFileDialog C#
- c# customizing controls on a save dialog -- how to disable parent folder button?
The reason to hide the Network shortcut is because under VPN environment accessing the "Network" would cause the C# app to crash.


After digging for a few more hours, I've actually found 2 alternatives.
Solution 1 - Hiding Navigation Panel
There are 2 ways to hide the navigation panel
WindowsAPICodePackand set theShowPlacesListtofalseORFileDialogNativeinterop file andHIDEPINNEDPLACESby using theSetOptionsExample 1a:
Example 1b, requires you take a copy of this file, which allows you to have access to
IFileDialog, and put it in your project:Using either one of the above implementations will hide the entire navigation panel. However, note that the user CAN STILL navigate away through the address bar within the dialog... so this isn't really a perfect solution, at least not for me, but perhaps it is for somebody else.
Solution 2 - Handling FolderChanging event
Although it feels a bit "hacky", this actually solved my original problem. You still need to install the NuGet
WindowsAPICodePackbut you no longer need to hide anything from the file dialog and just use it as-is.And you could check for the actual path/folder/item being selected, in the screenshot below, it shows when the "Network" shortcut was being clicked, and by setting
Canceltotruewe can ignores the selection.Hope this helps someone.