Good day,
I am doing what seems relatively common. When the user double-clicks on a node in a wintree I want to open up a form based on the data for that node.
Is this the best way:
private void utCars_DoubleClick(object sender, EventArgs e){ UltraTreeNode node = utCars.UIElement.LastElementEntered.GetContext(typeof (UltraTreeNode)) as UltraTreeNode; if (node != null){ DataRowView dataRow = (DataRowView) node.ListObject; if (dataRow.DataView.Table.TableName == "Sedan") { int s = (int)dataRow.Row["SedanID"]; DoSomething(s); }}}
Thanks
Gina_M
I don't see anything wrong with this code per se, but personally I would handle the MouseDoubleClick event and use the control's GetNodeFromPoint method therein. Remember to check for a null return from that method as will be the case when the user double-clicks somewhere other than on a node.
Thanks much! I will give it a try. My way seems to work pretty good but I always like to follow the advice of the experts. :)
Are there any cases in which my solution will not work?
-Gina_M
Gina_Marano said:Are there any cases in which my solution will not work?