private void treeview_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e) { if (e.NewValue != null) { outline o = (e.NewValue as outline); if (o != null) { if (o.url.StartsWith("http://")) { LoadPhotos(o.url); } } } }
private ObservableCollection <outline> getChildren(XmlNode xn) { ObservableCollection <outline> list = new ObservableCollection <outline>(); foreach (XmlNode xn2 in xn.ChildNodes) { outline ol = new outline() { text = getAttribute("text", xn2), type = getAttribute("type", xn2), url = getAttribute("url", xn2) }; ol.children.AddRange(getChildren(xn2)); list.Add(ol); } return(list); }