Question: I need to get the same result I got, just by using react
I can't seem to find a way to reach the unorderd list if I creat it in the return of the render function, I'm new to react and just found out that getElementById just returns null in this case

(create an unordered list, Clicking on one of the items toggle the color of the item's text color)

```
import React, { Component } from 'react';
import { render } from 'react-dom';
import './style.css';

var defaultColor = 'black'
var specialColor = 'red'
var itemList =[1,2,3,4,5]
var id = document.getElementById('list')

class App extends Component {
  constructor() {
super();
this.state = {
  name: 'React'
}
function toggleColor(ctrl)
{       
    if(ctrl.color == specialColor){
      ctrl.color = defaultColor
    }
    else{
    ctrl.color = specialColor;
  }
}
function createLiWithColorToggle(item){

  var newLi= document.createElement('li')
  var newFont= document.createElement('font')
  newFont.innerHTML = item
  newFont.onclick = ()=>toggleColor(newFont)

  newLi.appendChild(newFont)
  id.appendChild(newLi)
}
itemList.forEach((item)=>{
  createLiWithColorToggle(item)
})
    };

  render() {
return (
  <div>

  </div>
);
  }
}

render(<App/>, document.getElementById('root'));

```

HTML file:

```
<div id="root"></div>

<ul id = "list"></ul>

```

Answer: 
If the TreeViewItem is not expanded then its children will not have any UI so you can't get their children. Maybe that's the problem you're seeing.

This is some code to think about, I don't have all your code to easily work out what's happening but this works on a sample I have. It is quick and dirty rather than super elegant. 

```
private void Button_Click(object sender, RoutedEventArgs e)
{
    foreach (var item in tv.Items)
    {
        TreeViewItem tvi = tv.ItemContainerGenerator.ContainerFromItem(item) as TreeViewItem;
        tvi.IsExpanded = true;
        tvi.UpdateLayout();
        RecurseItem(tvi);
    }
}

private bool gotTheItem = false;
private void RecurseItem(TreeViewItem item)
{
    foreach (var subItem in item.Items)
    {
        TreeViewItem tvi = item.ItemContainerGenerator.ContainerFromItem(subItem) as TreeViewItem;
        // do something
        if (!gotTheItem)
        {
            RecurseItem(tvi);
        }
    }
}

```

You could set `IsExpanded` back or hook the event fires when you expand an item and probably some other things.
The TV has a nodes collection. Each node also has a nodes collection.

You need to start at the root, examine each node, and if that node contains a nodes collection with a length > 0, you need to descend into it.

This is typically done with a recursive tree walk.