This question is locked. New answers and comments are not allowed.
Hello
I am studying your treeviewloadondemandriaservices.zip sample project. I would like to add another level to the tree so it would be
Customers --> Orders --> Order_Details --> Product
No luck getting Products to load, perhaps it is my data templates.
Part of the xaml for the view
Part of the code-behind for the view:
When I expand the order detail node, the context load is hit, but the order detail node does not expand, the loading arrow just spins.
Thanks in advance!
I am studying your treeviewloadondemandriaservices.zip sample project. I would like to add another level to the tree so it would be
Customers --> Orders --> Order_Details --> Product
No luck getting Products to load, perhaps it is my data templates.
Part of the xaml for the view
<navigation:Page.Resources> <DataTemplate x:Key="DetailTemplate"> <StackPanel Orientation="Horizontal"> <TextBlock Text="ProductID: "/> <TextBlock Text="{Binding ProductID}"/> </StackPanel> </DataTemplate> <telerik:HierarchicalDataTemplate x:Key="ProductTemplate" ItemsSource="{Binding Products}" ItemTemplate="{StaticResource DetailTemplate}"> <StackPanel Orientation="Horizontal"> <TextBlock Text="Order Detail Row [Quantity Field]: "/> <TextBlock Text="{Binding Quantity}"/> </StackPanel> </telerik:HierarchicalDataTemplate> <telerik:HierarchicalDataTemplate x:Key="OrderTemplate" ItemsSource="{Binding Order_Details}" ItemTemplate="{StaticResource ProductTemplate}"> <StackPanel Orientation="Horizontal"> <TextBlock Text="OrderID: "/> <TextBlock Text="{Binding OrderID}"/> </StackPanel> </telerik:HierarchicalDataTemplate> <telerik:HierarchicalDataTemplate x:Name="Root" x:Key="CustomerTemplate" ItemsSource="{Binding Orders}" ItemTemplate="{StaticResource OrderTemplate}"> <StackPanel Orientation="Horizontal"> <TextBlock Text="CustomerID: "/> <TextBlock Text="{Binding CustomerID}"/> </StackPanel> </telerik:HierarchicalDataTemplate> </navigation:Page.Resources>Part of the code-behind for the view:
private void myTreeView_LoadOnDemand(object sender, Telerik.Windows.RadRoutedEventArgs e) { RadTreeViewItem clickedItem = e.OriginalSource as RadTreeViewItem; switch (clickedItem.Item.GetType().Name) { case "Customer": _Context.Load(_Context.GetOrdersByCustomerIDQuery((clickedItem.Item as Customer).CustomerID)); break; case "Order": _Context.Load(_Context.GetOrderDetailsQuery((clickedItem.Item as Order).OrderID)); break; case "Order_Detail": //Get the Product info for the Order Detail record _Context.Load(_Context.GetProductsByOrderDetailQuery((clickedItem.Item as Order_Detail).OrderID, (clickedItem.Item as Order_Detail).ProductID)); break; default: break; } } private void myTreeView_ItemPrepared(object sender, RadTreeViewItemPreparedEventArgs e) { if (e.PreparedItem.Item is Product) { e.PreparedItem.IsLoadOnDemandEnabled = false; } }When I expand the order detail node, the context load is hit, but the order detail node does not expand, the loading arrow just spins.
Thanks in advance!