I think the problem that you're going to run into with this is that you would need to know the exact setup of the grid beforehand. In looking into the code from the self-referencing hierarchy demo
, there are both GridBoundColumns and GridExpandColumns at work here, so theoretically you would need to have knowledge of how to structure your grid before you could put any data into it to make the hierarchy.
Out of curiosity, why do you need to create the columns during runtime if the basic self-referencing hierarchy example takes care of creating everything for you? Knowing this might help some of the Grid-wizards that frequent here to come up some some sort of workaround or trick that could fit your scenario.