LogoLogo
HomeNewsSupportVideos
  • Introduction
  • Getting Started
  • What's new in 4.0
    • Known Issues
    • .NET Core Designer
    • Managed Graphics
    • Fluent Markup
    • Markdown Support
    • Upgrade from 3.x
  • Releases
    • What's new in 4.0
    • What's new in 3.5
    • What's new in 3.2
      • View Builder
      • Validation Rules
      • Enhanced Font Support
      • Design-Time Debug
    • What's new in 3.1
    • What's new in 3.0
      • FAQs
      • Update Existing Projects
      • Multi Targeting
      • Visual Studio Designer
      • Referencing Assemblies
      • Docker Support
      • Troubleshooting
      • Deployment
    • What's new in 2.5
    • What's new in 2.2
    • What's new in 2.1
    • What's new in 2.0
    • Upgrade from 1.x
  • Getting Started
    • New Project
    • Templates
    • Troubleshooting
    • License Activation
    • FAQ
    • API
    • Hybrid
    • Deployment
    • Theme Builder
  • Concepts
    • Startup
    • Configuration
    • Load Balancing
    • Designer
    • Layouts
    • Client Profiles
    • Tab Order
    • Compression
    • Embedded Resources
    • Modal Workflow
    • Localization
    • RightToLeft
    • Background Tasks
    • Real Time Web Applications
    • JavaScript
    • JavaScript Object Model
    • Security
    • Synchronization
    • Session Management
    • Theming
    • Dependency Injection
    • Application Switches
    • Visual Studio Code
  • Controls & Components
    • General
      • Application
      • AutoSizing
      • AutoScroll
      • AutoScaling
      • Accessibility
      • Colors & Fonts
      • Embedded Tools
      • Events
      • Touch Events
      • Images
      • Labels
      • ToolTips
      • Data Binding
      • Common Properties
      • Custom Painting
      • Move & Resize
      • Drag & Drop
      • Validation
      • User Data
      • Responsive Properties
      • VB.NET Extensions
    • Common Dialogs
      • FolderBrowserDialog
      • ColorDialog
      • OpenFileDialog
      • SaveFileDialog
    • Editors
      • TextBox
        • TagTextBox
        • MaskedTextBox
        • TypedTextBox
      • DateTimePicker
      • MonthCalendar
      • TimeUpDown
      • DomainUpDown
      • NumericUpDown
      • TrackBar
    • Buttons
      • Button
      • SplitButton
      • CheckBox
      • RadioButton
    • Containers
      • Page
      • Form
      • Desktop
      • Panel
      • FlexLayoutPanel
      • FlowLayoutPanel
      • TableLayoutPanel
      • GroupBox
      • Accordion
      • TabControl
      • UserPopup
      • UserControl
      • ToolBar
      • StatusBar
      • SplitContainer
      • SlideBar
    • Lists & Grids
      • ComboBox
        • UserComboBox
        • TreeViewComboBox
        • ListViewComboBox
      • ListBox
        • CheckedListBox
      • TreeView
      • ListView
      • DataGridView
        • Column
        • TextBoxColumn
        • ButtonColumn
        • LinkColumn
        • ImageColumn
        • MaskedTextBoxColumn
        • DateTimePickerColumn
        • NumericUpDownColumn
        • CheckBoxColumn
        • ComboBoxColumn
      • DataRepeater
      • PropertyGrid
    • Extenders
      • Animation
      • ToolTip
      • ErrorProvider
      • Rotation
      • StyleSheet
      • JavaScript
    • Media
      • Audio
      • Video
      • FlashPlayer
    • Content
      • Label
      • LinkLabel
      • PictureBox
      • ScrollBars
      • Upload
      • AspNetPanel
      • ImageList
      • PdfViewer
      • ProgressBar
      • Spacer
      • Widget
      • WebBrowser
      • IFramePanel
      • HtmlPanel
      • Canvas
      • Shape
      • Line
    • Menus
      • MainMenu
      • MenuBar
      • MenuItem
      • LinkMenuItem
      • ContextMenu
    • Notifications
      • AlertBox
      • MessageBox
      • Toast
    • Other Components
      • Timer
      • BindingSource
      • BindingNavigator
      • DataSet
      • EventLog
      • MessageQueue
      • PerformanceCounter
Powered by GitBook
On this page
  • Features
  • Multiple Roots
  • Help
  • How To
  • Customize the Appearance
  • Advanced
  • Using a Custom Template

Was this helpful?

Export as PDF
  1. Controls & Components
  2. Common Dialogs

FolderBrowserDialog

Allows the user to select a folder from one of the Roots.

PreviousCommon DialogsNextColorDialog

Last updated 2 months ago

Was this helpful?

This class provides a way to prompt the user to browse, create, and eventually select a folder. Use this class when you only want to allow the user to select folders, not files. Browsing of the folders is done through a tree control. Only folders from the file system can be selected; virtual folders cannot.

Typically, after creating a new FolderBrowserDialog, you set the RootFolder to the location from which to start browsing. Optionally, you can set the SelectedPath to an absolute path of a subfolder of RootFolder that will initially be selected. You can also optionally set the Description property to provide additional instructions to the user. Finally, call the ShowDialog method to display the dialog box to the user. When the dialog box is closed and the dialog box result from ShowDialog is DialogResult.OK, the SelectedPath will be a string containing the path to the selected folder.

You can use the ShowNewFolderButton property to control if the user is able to create new folders with the New Folder button.

FolderBrowserDialog is a modal dialog box; therefore, when shown, it blocks the rest of the application until the user has chosen a folder. When a dialog box is displayed modally, no input (keyboard or mouse click) can occur except to objects on the dialog box. The program must hide or close the dialog box (usually in response to some user action) before input to the calling program can occur.

For a full list of properties, methods and events see the

Features

Multiple Roots

The FolderBrowserDialog component allows for setting multiple directory roots to navigate and select a file.

Directories must have the appropriate read permissions to be discoverable by the Wisej.NET application.

Help

The FolderBrowserDialog component has an optional "?" (Help) tool that allows you to process and display information to help users navigate the control.

How To

Customize the Appearance

The FolderBrowserDialog component can be customized by applying appearances to each individual control within the dialog. This includes the tree view, buttons, and bottom panel.

To customize these controls, create a new class that inherits from FolderBrowserDialogUI, add the custom FolderBrowserDialog constructor, and modify the controls within it:

public partial class CustomFolderBrowserDialogUI : FolderBrowserDialogUI
{
  public CustomFolderBrowserDialogUI(FolderBrowserDialog folderDialog) : base(folderDialog)
  {
    this.HeaderBackColor = Color.CadetBlue;
    this.buttonOpen.BackColor = Color.CadetBlue;
  }
}

After applying the FolderBrowserDialog's DialogTemplate property to the new class, the resulting popup will look like this:

For instructions on how to use a custom template to offer advanced customization of the FolderBrowserDialog, see below.

Advanced

Using a Custom Template

The FolderBrowserDialog is fully customizable through the DialogTemplate property. This property, when set, will provide a custom interface for allowing users to select a directory from one of the given Roots.

To build a new custom template, create a new Inherited Window in the project.

After clicking Add, you'll be shown a list of inheritable windows. Select FolderBrowserDialogUI and click OK.

Using a custom template requires implementing a custom constructor for processing dialog initialization.

The custom constructor has one argument, a FolderBrowserDialog instance that contains the configuration required to build the dialog.

The property returns the path selected by the user, which is the virtual path relative to the root. To retrieve the physical path on the server use .

FolderBrowserDialog.SelectedPath
FileBrowserDialog.MapPath()
API documentation.
FolderBrowserDialog showing multiple root directories for navigation
FolderBrowserDialog showing help button and navigation interface
Customized FolderBrowserDialog with cadet blue theme applied
Dialog showing the Inherited Window creation option
Dialog showing FolderBrowserDialogUI selection