Get logical path from treeview which has HierarchicalDataTemplate
- by phenevo
Hi,
I have a structure of geography objects:
Country
Areas,
Provinces,
Cities
and Hotels
Country has regions, regions provinces etc...
Whne I'll click City node I wanna to get logical path eg: France,Provanse,SomeProvince,Montpellier,Coral Hotel.
Each class has fields: name, code nad listOf...
Treeview works great, but this method not:
private void structureTree_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
if (structureTree.SelectedItem is Hotel)
{
objectCode = ((Hotel)structureTree.SelectedItem).Code;
TreeViewItem item = e.OriginalSource as TreeViewItem;
DependencyObject parent = VisualTreeHelper.GetParent(item);
dlgEditHotel(objectCode, structureTree.Parent.ToString());
}
}