Hi, I'm having a problem with XamDataTree, that has already been reported on stackoverflow: http://stackoverflow.com/questions/6295882/programmatically-activate-a-node-in-infragistics-xamdatatree
I'll simply cut&paste the question on stackoverflow, since it exactly matches my situation. Do you have any suggestion? Thanks a lot, cheers!
--
I'm using Infragistics NetAdvantage for Win Client 2010 Vol. 3.
I made a WPF User Control that shows some nested items using a XamDataTree control. Tree nodes are loaded from a binded Observable item collection:
MenuNode menuTree = getMenuTree(true); ObservableCollection<MenuNode> menuNodes = menuTree.children; this.treeFP.ItemsSource = menuNodes;
I couldn't find a suitable tree method that activates a node based on certain property (eg. a key?). So I created a method that loops through the whole tree, until it finds the correct node to activate:
void selectNode(XamDataTreeNodesCollection nodes, string nodeKey)
I then called this method in this way:
selectNode(theTree.Nodes, "KEYTOSELECT");
It turned out that theTree.Nodes collection is empty! Why? Probably because items source is binded? If this behaviour is correct (?), is there another way to activate a single node?
The only thing I could think of without seeing it happen is that you are calling it prior to the loaded event of the tree. The Data won't be bound until the tree is loaded.
Hi Darrel,
I initialize my tree in the User Control's constructor, after InitializeComponent() call. And then, I try to activate a single node. Data is correctly bound (I think), because I can see my nodes on tree.
The problem affects only the underlying object model: Nodes collection is empty, while tree is full of nodes! Very strange...
Thank you for your reply. Bye!