We are trying to use the treelistview in on demand loading much like your example
in the demos.. Our data comes from a web service call and we are running into 2 show stoppers. The most troubling is wrong insertion of child nodes into the tree as a result of an “out of the norm” design of our hierarchy that I will share later. My XAML is almost the same as your example
<telerik:RadTreeListView x:Name="ConceptBankTreeView" RowLoaded="RadTreeListView_RowLoaded" RowIsExpandedChanging="RadTreeListView_RowIsExpandedChanging"
Background="White" BorderBrush="{StaticResource TreeBorder1}"AutoGenerateColumns="False" HorizontalAlignment="Stretch"VerticalAlignment="Stretch" VirtualizingStackPanel.VirtualizationMode="Recycling" KeyDown="ConceptBankTreeView_KeyDown">
<telerik:RadTreeListView.ChildTableDefinitions>
<telerik:TreeListViewTableDefinition x:Name="Child" ItemsSource="{Binding ChildConcepts}" />
</telerik:RadTreeListView.ChildTableDefinitions>
<telerik:RadTreeListView.Columns>
<telerik:GridViewCheckBoxColumn Width="25" DataMemberBinding="{Binding Selected, Mode=TwoWay}" ></telerik:GridViewCheckBoxColumn>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Display}" Header="Product ID" Width="160" >
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBox x:Name="ConceptEditTxtBx" Text="{Binding Display,Mode=TwoWay}" Background="Transparent" BorderThickness="0" TextWrapping="Wrap" GotFocus="ConceptEditTxtBx_GotFocus" />
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
things loads nicely as we load some data from the server and s we set the ItemsSource (one time) to an ObservableCollection which reflects our hierarchy . we will later add child node list to this in a tree like manner.
.ConceptBankTreeView.ItemsSource = OurObjectsHierachy;
WE have the requirement to lazy load the child leafs as they are expanded by the user and I use following to do this:
void RadTreeListView_RowIsExpandedChanging(object sender, RowCancelEventArgs e)
{
ActiveConcept = e.Row.DataContext as ParentConceptDO;
if (ActiveConcept != null )
RequestChildrenInConceptBankDG(ActiveConcept,null);
}
we call the method to get the data from the server and it ends up populating the ChildItems list in the
ActiveConcept. so we see the child items but there an indentation issue as the treelist seems to want to make sure
the columns in the parent and child rows line up. But is there a way to turn this behavior off?
Now we might be able to live with this but we also have child items that are also parents and therefore appear in the initial list of nodes. E.g
my parents list is:
Florida
California
New Mexico
and if New Merico has as it child Florida we want to list to look like:
Florida
California
New Mexico
Florida
but what we see is
Florida
Florida
California
>New Merxico
so it expands New Mexico but puts the child is the top level! It has been assigned the wrong parent (it is null) and
not NewMexico. I cannot see a way to programmatically set the parent of the row. Are we trying to something that your treelist cannot do, this would be a shame as it is almost there.