C# TreeView that shows CheckBoxes ONLY in chosen Nodes

Hello,

Could you please help me to create a TreeView (C#). The TreeView must have CheckBoxes only in some Nodes (parent or children does not matter) chosen at run-time. I do not want my TreeView to have a CheckBoxes in any Node, as it is in .Net Framework now.

Thank you.
AJBykovAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
gregoryyoungConnect With a Mentor Commented:
you would need to override the painting of the treeview (not trivial) or deal directly with the API ...

if you want to do this I can give you some examples ...
0
 
gregoryyoungCommented:
there is a property of the node which says whether or not there is a checkbox.
0
 
gregoryyoungCommented:
i am not quite sure what else you are asking for.
0
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

 
AJBykovAuthor Commented:
Every TreeNode has Checked property. When I set TreeView -> CheckBoxes property every Node in TreeView gets a CheckBox. I do not need a CheckBox near every Node. I would like to decide in run-time which node has a CheckBox and which does not. Looks like I have to create my own TreeView...
0
 
AJBykovAuthor Commented:
Yes, please. I will override the painting of the TreeView. If you could provide me a sample I would greatly appreciate that.
0
 
shilpa2784Commented:
Do you want to get the checkbox for a specific node at the runtime?? If yes i dont think it is possible with the existing treeview control ....u have to override and create your own treeview control
0
 
AJBykovAuthor Commented:
Yes, I am doing that right now. Could you tell me that the button "Accept" (near a comment) means?
0
 
gregoryyoungCommented:
it means to accept that comment as your answer ... I started working on this last night but its not only a few lines of code, I will try to get back to it this evening.
0
 
AJBykovAuthor Commented:
Thank you!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.