I have a tree that looks partially like the following:
I am using a context menu on a right click. I can detect clicking on a column header from the MouseUp event by walking up the ElementFromPoint at the mouse location to get the UltraTreeNodeHeaderUIElement. But the Node property is always null (Nothing). That Node property is documented as "Returns the UltraTreeNode instance associated with this UltraTreeNodeColumnHeaderUIElement instance, or null if it is not associated with a specific node". I assume that each of my column headers is associated with the node to which the column set is 'attached' since I have a column header on very node that has a column set. I need to find the parenting node (in the first case, the parenting node is 'Medication Care'). Short of trying to adjust the mouse location arbitrarily to try to find the node immediately above the column header, is there a particular way to find it?
I believe the Node property only returns a non-null value when using the FreeForm ViewStyle and the node's Override.ColumnSet property is set to a ColumnSet.
I have attached a small VB.Net project that populates the tree and has a handler for the MouseUp event I am using. The header's Node property is always Nothing; I have the ViewStyle set to FreeForm and there is a column set attached to the parent node's nodes property. So what am I doing wrong?
You are assigning the column set to the Override of the Nodes collection, not to the Override for an individual node, therefore the header is not uniquely associated with one particular node, which is why the Node property for the UltraTreeNodeColumnHeaderUIElement returns null. There is nothing wrong with your code, but the UltraTreeNodeColumnHeaderUIElement.Node property only returns a non-null value when the header is distinctly associated with one node, and this only happens when the column set is assigned to the UltraTreeNode.Override.
Brian, I decided to go ahead and see the effect of setting the ColSet into the Node override. I did this in my sample that I previously uploaded by removing the Nodes override and applying the override to the node with the columns:
oNode = ndRx.Nodes.Add()
' Assign the 'rnox' column set to the orders node node's collection
oNode.Override.ColumnSet = utPlanCare.ColumnSettings.ColumnSets(
"rnox")
I still get Nothing for the Node when I walk the element up to the header. So is this now a bug?