We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Silverlight TreeViewAdv nodes not populated

Thread ID:

Created:

Updated:

Platform:

Replies:

101908 Dec 1,2011 10:28 PM UTC Dec 7,2011 07:43 PM UTC Silverlight 1
loading
Tags: Tools
Darryl Mataya
Asked On December 1, 2011 10:28 PM UTC

I am trying to set default node visibility in a TreeViewAdv to only the top N levels programmatically. This treeview has an ObservableCollection ItemsSource and uses a data template for display. It seems that each level's child nodes aren't populated in the TreeViewAdv.Nodes collection until they otherwise become visible. With the following code example if all nodes aren't expanded by default (with the TreeViewAdv.IsExpanded property), then it only sees a Nodes collection for the top node pointed to by our collection. However if I do expand all nodes in the treeviewadv property, then it finds all the nested child nodes. How can I access the child nodes when they aren't yet visible? I don't want to make them all visible then shrink to the default view because it is confusing to a user.


void expandToLevel(int level)
{
if (chartTree.Nodes.Count > 0)
{ handleCurrentNode(chartTree.Nodes[0], level, 0); }
}

void handleCurrentNode(TreeViewItemAdv node, int expandToLevel, int currentlevel)
{
node.IsExpanded = (currentlevel < expandToLevel);
foreach (TreeViewItemAdv child in node.Nodes)
{
handleCurrentNode(child, expandToLevel, currentlevel + 1);
}
}



Karthikeyan L [Syncfusion]
Replied On December 7, 2011 07:43 PM UTC

Hi Darryl,

Thank you for showing interest on Syncfusion products.

Using the IsExpanded property and IsVisibility property the expanded mode and visibility of TreeViewAdv can be set. By binding these property of the TreeViewAdv will simplify the usage of properties inside codebehind. We have prepared a sample based on your requirement and we have attached for your reference.

Sample link: http://www.syncfusion.com/downloads/Support/DirectTrac/General/TreeViewVisibility1660423607.zip

Let us know if you have any other queries.

Thank you,
Karthikeyan.



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;