Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

WPF TreeView

$
0
0

I created a treenode like the below code. These nodes are propertypath of Object called Message Element. Message Element has (int Id, string propertypath, Transaction transaction)

Here is the code to build the tree for the propertypath: I created one class and defined these metods for the path.

publicList<TreeModel> BuildTree(IEnumerable<string> strings)

        {

           return (

             from sin strings

             let split = s.Split('.')

             group sby s.Split('.')[0]into g

              selectnewTreeModel

              {

                  Value = g.Key,

                  Children = BuildTree(

                   from sin g

                   where s.Length > g.Key.Length + 1

                   select s.Substring(g.Key.Length + 1))

              }

              ).ToList();

           Console.WriteLine(Value);

          

        }

public List<TreeModel> getTreeNodes()

    {

// nodes for request and create another node for response

        string[] request = {

                              "Root",

                             "Root.Item1",

                             "Root.Item2",

                             "Root.Item3.SubItem1",

                             "Root.Item3.SubItem2",

                             "Root.Item4.SubItem1",

                             "AnotherRoot"

                         };

        List<TreeModel> nodeList = BuildTree(request);

        return nodeList;

    }                                

 2. There is object called Transaction it has (string WSMethod, string  Request Message and string ResponseMessage)

For every WSMethod there is Request Message and string ResponseMessage. The nodes I created in the above code (the propertypaths) needs to be associated with each  RequestMessage and ResponseMessage.

What I mean is when we look at the tree view , There will be two roots created from Request Message which has nodes of request and ResponseMessage which has nodes of response.

3. The Transaction objects are displayed in my combobox and the association I need to make in step two will be displayed in the tree view.

4. The idea is when WSMethod transaction combobox is selected I want to display nodes  I associated in step 3 which I don’t know how.

Can someone please give me some guidance?


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>