Getting the SelectedIndex of a child node in a TreeView
问题 I am currently working on a wpf project in C#. I have a treeview created that has parent nodes with childen nodes inside of it. I was wondering if there was a way to get the index of the child node the user clicked on. (Simmilar to ".SelectedIndex" when using comboboxes) I have tried Various ways such as: int val =TreeView.SelectedItemProperty.GlobalIndex; and fileInput.IndexOf(treeView1.SelectedItem); But they dont seem to work. Any suggestions or comments are greatly appreciated. Thanks 回答1