Hi,
I have a structure of geography objects:
Country
Areas,
Provinces,
Cities
and Hotels
Country has areas, areas has provinces, provinces has cities, and cities has hotels. Whne I'll click City node I wanna to get logical path eg: France,Provanse,SomeProvince,Montpellier,Grand 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());
}
}
`**structureTree.SelectedItem as TreeViewItem **`
gives me null, when I'll click at some area, province,city or hotel