TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
David Smith
NA
2k
0
TreeView Check Nodes and Unselect Nodes
Nov 13 2017 7:56 PM
I have having trouble Checking nodes with the logic below. Can someone tell me what i am missing?
private void tvTestSequence_AfterCheck(object sender, TreeViewEventArgs e)
{
if (e.Action != TreeViewAction.Unknown)
{
if (e.Node.Nodes.Count > 0)
{
if (!e.Node.Checked)
{
this.CheckAllChildNodes(e.Node, e.Node.Checked);
}
}
}
if (e.Node.Parent != null)
{
TreeNode n = e.Node;
while (n.Parent != null)
{
if (n.Checked)
{
n.Parent.Checked = true;
}
n = n.Parent;
}
}
}
private void CheckAllChildNodes(TreeNode treeNode, bool nodeChecked)
{
foreach (TreeNode node in treeNode.Nodes)
{
node.Checked = nodeChecked;
if (node.Nodes.Count > 0)
{
this.CheckAllChildNodes(node, nodeChecked);
}
}
}
Reply
Answers (
1
)
What am I Doing Wrong?
How To Create a Generic Sortable Listview in Uwp Xaml