Exam Guide: Binding to Hierarchical Data using TreeViews

 

image

Rebecca, your manager, has asked that you create a Windows Presentation Foundation (WPF) application.

Your application uses the Team business object. The Team business object is a collection of Team objects. Each Team object has a Contact collection that contains Contact objects.

During your discussion, CRO has pointed that it would be most efficient to bind a TreeView control to the Team collection. CRO show you how the TreeView control should display the data as shown on the whiteboard:

image

So Armando (the guy wearing the beret) writes down an example of the data:

Contact

Jane Doe

      555-555-5555

      533-333-1111

      https://twitter.com/Doughy

John Smith

                    555-111-3333

      https://www.facebook.com/John.Smith

      https://twitter.com/johnsmith

Now that the output has been visualized, CRO discusses the various options with Armando, looks like CRO needs his coffee and cookie break:

image

Ummm, CRO doesn’t seem to be getting it.  Rebecca shows up to help out, CRO has some anger issues and has agreed to deal with them, but Rebecca sees that as a team, a different insight will be helpful:

image So the team has come to a happy ending, Rebecca has shown her capabilities as a manager, CRO knows his stuff, but now he knows more, and Armando has some coding to do! 

The line for Armando should have read the following way:

       “Since we are using the TreeView, then the way to go is to use HierarchicalDataTemplate”