5 Answers, 1 is accepted
Hello, Oliver,
Note that the ExlorerControl internally uses a RadTreeView for displaying the hierarchical structure of files/folders. It is displayed on the left side of the ExlorerControl. On the right, it uses a RadListView.
In order to detect selection in both controls, feel free to use the following code snippet:
public RadForm1()
{
InitializeComponent();
this.explorerControl1.MainNavigationTreeView.SelectedNodeChanged += MainNavigationTreeView_SelectedNodeChanged;
this.explorerControl1.FileBrowserListView.SelectedItemChanged += FileBrowserListView_SelectedItemChanged;
}
private void FileBrowserListView_SelectedItemChanged(object sender, EventArgs e)
{
if (this.explorerControl1.FileBrowserListView.SelectedItem != null)
{
Console.WriteLine(this.explorerControl1.FileBrowserListView.SelectedItem.Text);
}
}
private void MainNavigationTreeView_SelectedNodeChanged(object sender, RadTreeViewEventArgs e)
{
Console.WriteLine("SelectedNode: " + e.Node.Text);
}
I hope this information helps. If you need any further assistance please don't hesitate to contact me.
Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Hi Dess,
with huge delay thanks for update here.
Btw. how can I do that from VB.NET?
Thanks,
Oliver
Please refer to the below code snippet in VB.NET:
Public Sub New()
InitializeComponent()
AddHandler Me.ExplorerControl1.MainNavigationTreeView.SelectedNodeChanged, AddressOf MainNavigationTreeView_SelectedNodeChanged
AddHandler Me.ExplorerControl1.FileBrowserListView.SelectedItemChanged, AddressOf FileBrowserListView_SelectedItemChanged
End Sub
Private Sub FileBrowserListView_SelectedItemChanged(ByVal sender As Object, ByVal e As EventArgs)
If Me.ExplorerControl1.FileBrowserListView.SelectedItem IsNot Nothing Then
Console.WriteLine(Me.ExplorerControl1.FileBrowserListView.SelectedItem.Text)
End If
End Sub
Private Sub MainNavigationTreeView_SelectedNodeChanged(ByVal sender As Object, ByVal e As RadTreeViewEventArgs)
Console.WriteLine("SelectedNode: " & e.Node.Text)
End Sub
Should you have further questions please let me know.
Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Thanks Dess.
Btw. convertors is providing:
Public Sub New()
InitializeComponent()
Me.explorerControl1.MainNavigationTreeView.SelectedNodeChanged += AddressOf MainNavigationTreeView_SelectedNodeChanged
Me.explorerControl1.FileBrowserListView.SelectedItemChanged += AddressOf FileBrowserListView_SelectedItemChanged
End Sub
Indeed, the online converter may not provide absolutely correct VB.NET as the event subscriptions because it uses an external API for the conversion and we can't control the produced result. You may need to fix some small issues in order to build the code. However, the online converter can save you a lot of time when migrating a C# project or piece of code to VB.NET. Feel free to use it in future.
Should you have further questions please let me know.
Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik