Click here to Skip to main content
15,388,688 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am having the structure with parent child and next node i need to write the logic for traversing as well as while traversing need to add the nodes and display in tree view dynamically.
here is my structre

public struct NODE
    {   unsafe public Intptr pNext;
        unsafe public Intptr  pChild;
        unsafe public Intptr  pParent;
        public string Name;

void updatetree()
TreeViewItem mytree = new TreeViewItem();
//here i need to do the logic for my problem

Uitreeview.Items.add(mytree);   //it is the treeview which i created in XAML file

What I have tried:

i tried traversing but i can able to traverse only a one child for all parents cant able to go depth childs in my struct having more parent and child nodes.
Updated 22-Feb-21 21:22pm

1 solution

We can't help you - we have no idea how you are building the tree, much less traversing it, and we have no access at all to the data you are sourcing the tree from.

So, it's going to be up to you.
Fortunately, you have a tool available to you which will help you find out what is going on: the debugger. If you don't know how to use it then a quick Google for "Visual Studio debugger" should give you the info you need.

Put a breakpoint on the first line in the function, and run your code through the debugger. Then look at your code, and at your data and work out what should happen manually. Then single step each line checking that what you expected to happen is exactly what did. When it isn't, that's when you have a problem, and you can back-track (or run it again and look more closely) to find out why.

Sorry, but we can't do that for you - time for you to learn a new (and very, very useful) skill: debugging!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900