Get logical path from treeview which has HierarchicalDataTemplate

Posted by phenevo on Stack Overflow See other posts from Stack Overflow or by phenevo
Published on 2010-04-23T13:01:04Z Indexed on 2010/04/23 13:03 UTC
Read the original article Hit count: 391

Filed under:
|
|

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());
            }
          }

© Stack Overflow or respective owner

Related posts about wpf

Related posts about c#