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.

TreeViewAdv InteractiveCheckBoxes

Thread ID:

Created:

Updated:

Platform:

Replies:

97309 Nov 16,2010 07:38 PM Aug 30,2012 12:50 AM Windows Forms 4
loading
Tags: Tools
Harold Hsu
Asked On November 16, 2010 07:38 PM

Hi,

The TreeViewAdv InteractiveCheckBoxes property gives me most of the functionality I want (check all child nodes, and set parent nodes to indeterminate), except I would like to be able to keep a parent node checked even if I uncheck all child nodes. Is there a way to do it?

Any help will be greatly appreciated!

Harold


Harold Hsu
Replied On November 16, 2010 08:23 PM

Follow up to my original question...attached is a sample project I did to do what I wanted by having InteractiveCheckBoxes = false and handling the AfterCheck event.

The problem I'm having is that even though I'm programmatically setting the child nodes' CheckState, the child nodes' AfterCheck event is raised with the TreeViewAdvAction set to ByMouse instead of Unknown. Here's the event handler:

private void treeViewAdv1_AfterCheck(object sender, TreeNodeAdvEventArgs e)
{
if (e.Action != TreeViewAdvAction.Unknown)
{
UpdateChildNodes(e.Node);
//UpdateParentNodes(e.Node);
}
}

private void UpdateChildNodes(TreeNodeAdv node)
{
// I can recursively checked all descendant nodes.
foreach (TreeNodeAdv childNode in node.Nodes)
{
childNode.CheckState = node.CheckState;
}
}

If you run the project, and check the root node, you can see all descendant nodes are checked, even though my UpdateChildNodes() does not recursively check all the child nodes. I'd expect TreeViewAdvAction is set to Unknown and the AfterCheck event raised by the child nodes will not execute UpdateChildNodes(). Perhaps I did something wrong?




WindowsFormsApplication2_40f0367a.zip

Vallarasu S [Syncfusion]
Replied On November 21, 2010 11:21 PM

Hi Harold,

Thanks for your interest in Syncfusion products.

In your sample node state processing is handled inside the AfterCheck event, and by design AfterCheck event is processed within the mouse down events, that causes the AfterCheck event to raise with the TreeViewAdvAction as ByMouse.

I have modified your sample to meet your requirement by ignoring the AfterCheck event raised by code.

Please refer the attached sample and let me know if this helps.

Regards
Vallarasu S.




TreeViewSample_fad0aeaa.zip

Harold Hsu
Replied On November 23, 2010 05:04 PM

Thanks!


Berkunath A [Syncfusion]
Replied On August 30, 2012 12:50 AM

Hi Harold,

Thanks for the update.
We are glad to help you out.

Regards,
A.Berkunath


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.

;