I m trying to expand and select related node on load on demand RadTreeView(telerik). but nodes are not expanded if nodes are not loaded yet.I used the same codes from
http://www.telerik.com/help/wpf/radtreeview-howto-exapand-select-item-with-lod-enabled-treeview.html
var itemsControl = Tree as ItemsControl;
var itemFound = true;
while (itemsControl != null && itemFound)
{
itemFound = false;
var currentObject = ObjList.FirstOrDefault();
for (int i = 0; i < itemsControl.Items.Count; i++)
{
var treeElement = itemsControl.Items[i] as TreeElement;
if (currentObject.Name == treeElement .Name)
{
itemFound = true;
networkObjList.RemoveAt(0);
BringIndexIntoView(itemsControl, i);
itemsControl.UpdateLayout();
var container = itemsControl.ItemContainerGenerator.ContainerFromIndex(i) as RadTreeViewItem;
if (container != null)
{
if (networkObjList.Count == 0)
{
container.IsSelected = true;
container.Focus();
}
else
{
container.IsExpanded = true;
}
container.UpdateLayout();
itemsControl = container as ItemsControl;
}
}
}
}
but non loaded nodes childs can not be filled. Why? could you help me?
And also I wonder that How does a container know when a child has loaded?
http://www.telerik.com/help/wpf/radtreeview-howto-exapand-select-item-with-lod-enabled-treeview.html
var itemsControl = Tree as ItemsControl;
var itemFound = true;
while (itemsControl != null && itemFound)
{
itemFound = false;
var currentObject = ObjList.FirstOrDefault();
for (int i = 0; i < itemsControl.Items.Count; i++)
{
var treeElement = itemsControl.Items[i] as TreeElement;
if (currentObject.Name == treeElement .Name)
{
itemFound = true;
networkObjList.RemoveAt(0);
BringIndexIntoView(itemsControl, i);
itemsControl.UpdateLayout();
var container = itemsControl.ItemContainerGenerator.ContainerFromIndex(i) as RadTreeViewItem;
if (container != null)
{
if (networkObjList.Count == 0)
{
container.IsSelected = true;
container.Focus();
}
else
{
container.IsExpanded = true;
}
container.UpdateLayout();
itemsControl = container as ItemsControl;
}
}
}
}
but non loaded nodes childs can not be filled. Why? could you help me?
And also I wonder that How does a container know when a child has loaded?