I use xamdatatree . when I check the parent'node,the parent's NodeCheckedChanged is invode,and his child's NodeCheckedChanged is invoke.So how can i get all the checked nodes when NodeCheckedChanged invoke? I don't want it invoke so much.
Yes, the event will still be invoked but you can add code like this now
bool _iAmHandlingTheClick = false;
and in the nodeCheckedChanged event
{
if (! _iAmHandlingTheClick )
_iAmHandlingTheClick = true;
// do whatever work you are going to do, along with checking the other nodes
_iAmHandlingTheClick = false;
}
By doing something like that, when the other nodes start raising their events, you won't be executing your code
Thank you for your reply.I just change my code.I have changed all the nodes Myself through code.But the child's NodeCheckedChanged still invoke. I don't understand "set a flag in your application to ignore the code in your handler". Can Use this ignore the child'sNodeCheckedChanged?
This behavior is by design, as it allows the user to react when a node's checkstate is modified.
You could set the CheckBoxSettings.CheckBoxMode to Manual and this will prevent the auto checking and auto response by the other nodes when one is checked. You would then have to change all the nodes yourself through code, but you would be able to set a flag in your application to ignore the code in your handler.