Tree Node Menu Structure in Windows Forms - c#

I am new to using Windows forms and am looking for help on creating a Tree Node Menu Structure in Windows Forms. I have tried reading the documentation on Microsoft docs and testing out the examples still with no clear understanding of how to create a tree node menu structure. Any help would be greatly appreciated as I am just learning Windows Forms.
Here is an example of how I would like the structure (the menu items should be tabs):
Node: Customers
-Child node: Add Customers
-Child Node: Add Customer Part

Not 100% sure if this is what you are looking for, but basically define your context menu (assuming a right click here)
nodeMenu As ContextMenuStrip
Build your items and a menu handler, then when your node is selected, define which items of the menu will be available along these lines:
if node.Text.Equals("Customers") then
nodeMenu.Items("Add Customers").Enabled = True
nodeMenu.Items("Add Customer Part").Enabled = True
Else
'do something else
End If
but that is to add a menu to a node.
I think what you want is add nodes under a specfic node, if that is the case, I believe what you are after is more likely the answer here:
https://stackoverflow.com/a/9963900/1946036

Related

Infragistics Drag and Drop Tree Expand Multiple Nodes Simultaneously

I am using the following Infragistics component for viewing hierarchical data.
http://www.igniteui.com/tree/drag-and-drop-single-tree
I could able to load data correct but the problem is wI cant expand multiple nodes simultaneously. I mean when I expand a node the other node collapsed expanding only the current node. Can some one please suggest if there is any configuration setting I am missing to accomplish this?
I want the nodes once expanded will remain expanded until user collapses it again.
Thanks,
Krishna Prasad
The option that controls that is singleBranchExpand. Set it to false to allow multiple nodes to be expanded at the same time. http://jsfiddle.net/ywtLL7ka/
$("#tree").igTree({
singleBranchExpand: false,
});

How to set threeview node checkbox to mix state i.e. if any of the child node is selected, Parent node should fill in to indicate that

I am working on a windows form application, where I connect to the database and get a list of projects and sub-projects. I am able to show this as a treeview with checkboxes, that later an user can select to do further operations.
My problem is that, I can't set the Parent node state when one of the child nodes is selected. Here, I want some indication, if any of the child nodes is selected the parent node should fill in to show that something has been selected below that parent node.
Okay, meanwhile, I found answer to my problem. Not really wise but thanks to this Simple Tri-State TreeView control. code link here.
I will definitely try to build my own custom version of this. For now, this works fine.

how to remove image from treeview after added

Using visual studios 2010 and c# i have a treeview and i added images to each of the nodes. In retrospect i now want to remove the images that are associated with the children of the 3 main root nodes. How do i remove the images from the children of my 3 main root nodes but keep the images on the 3 root nodes?
I have tried opening the properties for the nodes and changed the ImageIndex and SelectedImageIndex to "none" for all of the children nodes and when i press ok, it still shows the default image for each child node.
Thanks
I'm not sure of it, but I believe that you can pass through every control inside the TreeView doing a foreach in [TreeView].Controls... In there you can search for [control].GetType() == typeof([type_of_the_image]), and do some logic to get just the main ones.
Besides that, you can remove by jQuery, doing something close to what I said above. If these ideas are something that interests you, I can help with the development.

specific context menu per UltraTreeNode

I have a problem using Infragistics UltraTree control.
I need a way to add a specific context menu to an UltraTreeNode.
I saw that there is a contextMenu property for the UltraTree, but I need a unique one per each node.
what is the best way for doing this in C#?
I've recently had to do this with a regular TreeView. Since infragistics.UltraTreeNode has a context menu just like the regular TreeNode, I'm guessing the technique will be the same.
Here's how I did it:
Step 1. Assign the context menu of interest to each node that should recieve it. This should be done while populating tree nodes.
Step 2. Intercept the Opening event on the context menu(s)
Step 3. Rebuild the contents of the menu in the "contextMenu_Opening" event handler. Only do this for a context menu object that will be shared among different node types. You can also add all items you want to the menu, up front on the treeview or containing controls construction, then hide or show them through the Visible property. This is really a matter of personal preference at this point.

move nodes on a treeview control

I am using the standard asp.net treeview control to display a menu structure that is getting bound from a database. The data structure has a parentID column to represent the node relationship if one exists.
Anyway, that's not an issue, I am looking for a treeview control that would allow a user to rearrange the node by dragging them to a new position within the tree. Can anyone point me in the right direction as to any controls out there that can do this? The windows form control has the move node events. IS there something like this for web forms? Any pointers greatly appreciated.
You can have look at ExtJS TreePanel.
Drag and Drop ordering in a TreePanel
Why not try the JQuery TreeView plug-in?
http://plugins.jquery.com/project/treeview
Not sure if meets all of your non-functional requirements, but if you click on the "Try out a demonstration" link, you should be able to see if it meets your needs.

Categories

Resources