The docs for InitializeNode event says "This event is raised when a XamDataTreeNode is created."
I've been monitoring this event in the debugger (VS2010 & Infragistics 11.2) and it appears this event only gets raised as a node comes into view. This implies that a node only gets created when ever it comes into view.
On the other hand, the ScrollNodeIntoView Method says: "Scrolls a XamDataTreeNode into the viewable area.".
My dilemma is: Is nodes are created only when they are in view, how is it that ScrollNodeIntoView does what the documentation says it does?
As you can see, I need a better understanding of the XamDataTree.
Is there any documentation (Articles, etc.) that would provide better insight into the operation of XamDataTree?
Hi Joe,
Please let me know if you have any further questions.
You can scroll the node into view with the following code:
collection.Add(new Data());XamDataTreeNode node = xamDataTree1.Nodes[collection.Count - 1];xamDataTree1.ScrollNodeIntoView(node);
In the above code collection is your collection where you add your data item that the XamDataTree is bound to. This will work because the XamDataTreeNode will be created when you access it. Note that accessing the node will also trigger InitializeNode to fire.
Let me know if you have any questions on this matter.
Rob, are you there? Anyone?
>>Whenever something tries to access the data within a node, the XamDataTree will create the node if it hasn't been created yet.
How can one access the data within a node without all ready having a referance to the node?
>>When you search for that node it's data is accessed and if it hasnt been created yet, the tree will create the node and trigger the InitializeNode event.
Oh, do you mean that I would search for the data using the search abilities of the Collection or Collection View Source that's attached to the XamDataTree through the ItemsSource property?
My scenario is this: my data is in an ObservableCollection which is the source for a CollectionViewSource which then is the ItemsSource for the XamDataTree. When I add an item to the ObservableCollection does that immediately trigger the creation of a XamDataTreeNode? If true, then I assume the InitializeNode event will be raised giving me access to the XamDataTreeNode and then I can ScrollNodeIntoView and set IsExpaned, etc.
The key thing I want to accomplish is when I add an object to my ObservableCollection I want to Scroll the node into view and have it expanded.
Thank you very much for your help!
Joe
Hi jgreene274,
Whenever something tries to access the data within a node, the XamDataTree will create the node if it hasn't been created yet. So for your question, in order to use the ScrollNodeIntoView method you need to supply a valid XamDataTreeNode object. When you search for that node it's data is accessed and if it hasnt been created yet, the tree will create the node and trigger the InitializeNode event. You can then use the node in the scroll method.
You can find more information about the XamDataTree here:http://help.infragistics.com/NetAdvantage/Silverlight/2011.2/CLR4.0/?page=xamDataTree.html
Let me know if you have any questions.