Hi,To get the child items as string i used the following code
private void treeview1_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
if (treeview1.SelectedItem != null)
{
Animal bar = (Animal)treeview1.SelectedItem;
string str = bar.Name;
int boxty = bar.BoxType;
int boxno = bar.BoxNo;
}
}
It works fine .But when i click on parent(instead of + sign),it goes to this code and shows error.Ofcourse im casting SelectedItem to my List-Animal. But i dont want this.I have to check,whether the clciked item is parent,if it is so then i will skip this coding.Only when i click the child items it will go to this coding. How can i do that?How can i identify the selected item is parent.