I\'ve got a Page class in my .edmx ADO.NET Entity Data Model file with with Parent and Children properties. It\'s for a hierarchy of Pages.
removed dead ImageSh
A different way: (well, very similar, but slightly different)
In your Window Load function:
PageEntities db = new PageEntities();
TreeViewPages.ItemsSource = db.Page.Where(u=>u.Parent==null);
Create a new file Page.cs
public partial class Page {
public ObjectQuery LoadedChildren {
get {
var ret = Children;
if(ret.IsLoaded==false) ret.Load();
return ret;
}
}
}
In your XAML:
Its not tested, but you should get the general idea.