)
We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to retrieve the selected folder and selected path in the WinForms NavigationView?

Platform: WinForms |
Control: NavigationView |
Published Date: August 10, 2015 |
Last Revised Date: January 7, 2020

Retrieve the selected folder and path

In NaviationView, you can retrieve the selected folder name and its path by using its SelectedBar and SelectedBars properties.

C#

string selectedPath = string.Empty;
//Gets the current selected bar
string selectedFolder = this.navigationView1.SelectedBar.Text;
//Gets the selected path
foreach (Syncfusion.Windows.Forms.Tools.Navigation.Bar item in this.navigationView1.SelectedBars)
{
    selectedPath += item.Text + "\\";
}

VB

Dim selectedPath As String = String.Empty
'Gets the currently selected bar
Dim selectedFolder As String = Me.navigationView1.SelectedBar.Text
'Gets the selected path
For Each item As Syncfusion.Windows.Forms.Tools.Navigation.Bar In Me.navigationView1.SelectedBars
    selectedPath &= item.Text & "\"
Next item

 

Show selected folder name and path of the selected bar

 

Figure 1: The selected folder name and selected path of the Selected bar.

Samples:

C#: http://www.syncfusion.com/downloads/support/directtrac/107258/ze/NavigationView-527470180

VB: http://www.syncfusion.com/downloads/support/directtrac/107258/ze/NavigationView_VB-7428156

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon