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

WPF TreeView parent and child

$
0
0

on my treeview I want to show the request and response values under a value called Parent. How can I create a parent for my request and response values?

 public ObservableCollection<TreeViewModel> getAllTreeNodes()
        {

            TransactionTypeViewModel tranViewModel = new TransactionTypeViewModel();


            var parent = new TreeViewModel { Value = "Parent" };
            var request = new TreeViewModel { Value = "request" };
            var response = new TreeViewModel { Value = "response" };

            List<TreeViewModel> nodes = getAllTreeNodesFromModel();

            request.Children = nodes;
            response.Children = nodes;


            parent.Children = request.Children; ??
           

            return new ObservableCollection<TreeViewModel>{
                parent};

        }


Viewing all articles
Browse latest Browse all 18858

Trending Articles



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