I am looking for a WPF control which is a hybrid of TreeView and DataGrid, something like the Visual Studio debugger or QuickBooks contacts list etc.
Any other solution on how to handle editable hierarchical data in WPF will be very welcommed as well.

This seems to me like a reasonably straightforward thing to implement if you design your view model properly.
You basically design the items the same way you would if displaying them in a normal data grid, i.e. each item has a property for each column. In all likelihood, your underlying data model is hierarchical, but the collection that the grid is bound to is going to be flattened, i.e. will contain an item for each node in the hierarchy irrespective of parent/child relationships.
The item view model has some additional properties:
Level,Children,IsExpanded, andIsVisible.Levelis a count of the node’s ancestors,Childrencontains the child view model nodes,IsExpandedis used in the UI, andIsVisibleis true if the node is visible. It also implements a property calledVisibleDescendants:You use
Level,HasChildren, andIsExpandedin the style for the item in the control’s first column: they control the left margin and what kind of icon (if any) is displayed.You also need to implement
ExpandCommandandCollapseCommandproperties. TheExpandCommandis enabled ifChildren.Any()is true andIsExpandedis false, and theCollapseCommandis enabled ifChildren.Any()is true andIsExpandedis true. These commands, when executed, change the value ofIsExpanded.And here’s where it gets interesting. The simple way to implement this may work for you: the items are exposed by a parent view model whose
Itemsproperty is not a collection. Instead, it’s an enumerator that travels down the chain of child view models and yields only the visible nodes:Whenever any descendant’s
IsVisibleproperty changes, the parent view model raisesPropertyChangedfor theItemsproperty, which forces the data grid to repopulate.There’s a less simple implementation too, where you make the
Itemsproperty a class that implementsINotifyCollectionChanged, and that raises the properCollectionChangedevents when descendant nodes become visible/invisible, but you only want to go there if performance is an issue.