Articles in this section
Category / Section

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

1 min read

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#: https://www.syncfusion.com/downloads/support/directtrac/107258/ze/NavigationView-527470180

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

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied