EpiTreeView Node Select/Change Event

Has anyone ever been able to add a select/change event on an EpiTreeView? EpiTreeView is not in the object explorer unfortunately and I can’t identify/setup the event.

I found this, but what was recommended (i.e. using RowChange and ViewNotification events) will not work for me. I added a bunch of nodes for UDTables and when the user clicks around the nodes these events are not reliable as sometimes the node selected doesn’t initiate a rowchange nor a viewchange event.

After a bit of tinkering I was able to come up with the below.

Note that multiple items can be selected

using Infragistics.Win.UltraWinTree;

public partial class Script
{
	// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
	// Begin Wizard Added Module Level Variables **

	// End Wizard Added Module Level Variables **

	// Add Custom Module Level Variables Here **

	EpiTreeView myTreeView;

	public void InitializeCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
		// Begin Wizard Added Variable Initialization
		myTreeView = ((EpiTreeView)csm.GetNativeControlReference("46c8ee42-a6f1-468b-95ba-6dfc13223ee2"));
		// End Wizard Added Variable Initialization

		// Begin Wizard Added Custom Method Calls

		this.myTreeView.AfterSelect += new Infragistics.Win.UltraWinTree.AfterNodeSelectEventHandler(this.myTreeView_AfterSelect);
		// End Wizard Added Custom Method Calls

	}

	public void DestroyCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
		// Begin Wizard Added Object Disposal
		this.myTreeView.AfterSelect -= new Infragistics.Win.UltraWinTree.AfterNodeSelectEventHandler(this.myTreeView_AfterSelect);

		// End Wizard Added Object Disposal

		// Begin Custom Code Disposal
		myTreeView = null;
		// End Custom Code Disposal
	}

	public void myTreeView_AfterSelect(object sender, SelectEventArgs e)
	{
		MessageBox.Show(e.NewSelections[0].Text.ToString());
	}

}

List of TreeView Events

1 Like

Nice! Thank you sir!

Wanted to add for anyone else. After you add the using statement, SelectEventArgs will be recognized:

using Infragistics.Win.UltraWinTree;

1 Like