This question is locked. New answers and comments are not allowed.
Hi,
I want to display selfreferencing Data (ContentID > ParentContentID) in a TreeListView. I am using EF4 and I am binding a DataSource to the ItemsSource of the TLV. So far I select the items by selecting the root items (ParentContentID=null) and including the children. This way I only get the first level of children. How can I
a) select the whole structure at once / with one qurey
b) load the next level of nodes after expanding a parent node?
Best regards,
chris
I want to display selfreferencing Data (ContentID > ParentContentID) in a TreeListView. I am using EF4 and I am binding a DataSource to the ItemsSource of the TLV. So far I select the items by selecting the root items (ParentContentID=null) and including the children. This way I only get the first level of children. How can I
a) select the whole structure at once / with one qurey
b) load the next level of nodes after expanding a parent node?
Best regards,
chris
<telerik:RadTreeListView Margin="5,5,5,33" AutoGenerateColumns="False" HierarchyColumnIndex="0" Name="RtlvMain" ItemTemplate="{StaticResource ItemTemplate}" ItemsSource="{Binding ElementName=contentDomainDataSource,Path=Data}" > <telerik:RadTreeListView.ChildTableDefinitions> <telerik:TreeListViewTableDefinition ItemsSource="{Binding Children}" /> </telerik:RadTreeListView.ChildTableDefinitions> <telerik:RadTreeListView.Columns> <telerik:GridViewDataColumn DataMemberBinding="{Binding Title}" Header="Title" Width="120"/> <telerik:GridViewDataColumn DataMemberBinding="{Binding LastChange}" Header="Date" Width="80"/> </telerik:RadTreeListView.Columns> </telerik:RadTreeListView>... <riaControls:DomainDataSource Name="contentDomainDataSource" AutoLoad="True" d:DesignData="{d:DesignInstance my:Content, CreateList=true}" Height="0" LoadedData="ContentDomainDataSource_LoadedData" QueryName="GetContentByProjectID_ParentID" Width="0"> <riaControls:DomainDataSource.DomainContext> <my:DscSketch /> </riaControls:DomainDataSource.DomainContext> <riaControls:DomainDataSource.QueryParameters> <riaControls:Parameter ParameterName="projectID" Value="{Binding ElementName=projectsDomainDataSource, Path=Data.CurrentItem.ProjectID}" /> <riaControls:Parameter ParameterName="parentContentID" Value="-1" /> </riaControls:DomainDataSource.QueryParameters> </riaControls:DomainDataSource> public IQueryable<Content> GetContentByProjectID_ParentID(int projectID, int parentContentID) { return this.ObjectContext.Contents.Include("Children").Where(c => c.ProjectID == projectID && c.ParentContentID== null).OrderByDescending(c=>c.ContentID); }...//This is the data Class to be displayed as a selfreferencing hierarchy: public partial class Content { internal sealed class ContentMetadata { // Metadata classes are not meant to be instantiated. private ContentMetadata() { } [Include] public Content Children { get; set; } public int ContentID { get; set; } public ContentType ContentType { get; set; } public Nullable<int> ContentTypeID { get; set; } public byte[] Doc { get; set; } public EntityCollection<Ink> Inks { get; set; } public Nullable<DateTime> LastChange { get; set; } public Nullable<int> ParentContentID { get; set; } public Project Project { get; set; } public Nullable<int> ProjectID { get; set; } public byte[] Thumb { get; set; } public string Title { get; set; } } }