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.
Syncfusion Feedback

TreeViewAdv InteractiveCheckBoxes

Thread ID:

Created:

Updated:

Platform:

Replies:

97309 Nov 17,2010 12:38 AM UTC Aug 30,2012 04:50 AM UTC Windows Forms 4
loading
Tags: Tools
Harold Hsu
Asked On November 17, 2010 12:38 AM UTC

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 17, 2010 01:23 AM UTC

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 22, 2010 04:21 AM UTC

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 10:04 PM UTC

Thanks!


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

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.

Warning Icon 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.Close Icon

;