We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

MultiColumnTreeView Node Selection order

Thread ID:

Created:

Updated:

Platform:

Replies:

82374 Jun 10,2009 09:43 PM Jun 11,2009 04:57 AM Windows Forms 1
loading
Tags: Tools
Sam Marrocco
Asked On June 10, 2009 09:43 PM

Using a MultiColumnTreeView, selected nodes are not returned in the order they were selected. Order in the .SelectedNodes collection seems to always be from top to bottom *visually* in the control.

Is it possible to obtain the list of selected nodes in the *order that the user selected them*?

Using Syncfusion Essential Studio 2008 Vol2 v6.3.0.6.

Fathima Shalini P [Syncfusion]
Replied On June 11, 2009 04:57 AM

Hi Sam,

Thank you for your interest in Syncfusion Products.

To get the SelectedNodes in the order they were selected, we need to keep track the selected TreeNodeAdvs and store it in a collecton. Kindly refer to the code snippet and the sample provided below that illustrates this:


private void multiColumnTreeView1_Click(object sender, EventArgs e)
{
bool flag = true, flag1 = false;
Point controlPoint = this.multiColumnTreeView1.PointToClient(Control.MousePosition);
TreeNodeAdv node = this.multiColumnTreeView1.GetNodeAtPoint(controlPoint);
//Remove the TreeNodeAdv from the collection when unselecting the TreeNodeAdv
for(int i = TreeCollection.Count-1 ; i>=0 ; i--)
{
if(node.Text == TreeCollection[i].Text)
{
TreeCollection.RemoveAt(i);
flag = false;
}
}
// Remove the previously selected Nodes when single select is done
for (int i = TreeCollection.Count - 1; i >= 0; i--)
{
flag1 = false;
foreach (TreeNodeAdv tree in this.multiColumnTreeView1.SelectedNodes)
{
if (tree.Text == TreeCollection[i].Text)
{
flag1 = true;
}
}
if (!flag1)
{
TreeCollection.RemoveAt(i);
}
}
if(flag)
{
TreeCollection.Add(node);
}
}


http://files.syncfusion.com/support/Tools.Windows/6.3.0.6/F82374/main.htm

Please let me know if any concerns.

Regards,
Fathima

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;