Take the 2-minute tour ×  I am working on an old MFC
application. There is a TreeView control in the application.
OnItemExpanding function is overridden. I am getting children of
a TreeViewItem by it is expanded. If a node is expanded for the
first time its children are populated. If there are no children
to an item then the expand icon (+ sign) removes from the
TreeViewItem.  Now problem is that I expanded one node which
doesn't have children. After doing some work children are added
to that node. But now I cannot get newly added children as
expand icon is missing. How I can refresh that particular node
in the TreeView. I have created a refresh button. In that I am
able to find my current selected node in the TreeView, but what
next.  Here is the code.  void
CMyTreeView::OnItemExpanding(CTreeCtrl& tree, NMHDR* pNMHDR,
LRESULT* pResult)     //This is only called when I click on
expand (+ sign)    //some check here which populates children.
void CMyTreeView::RefreshNode(CTreeCtrl& tree, HTREEITEM
selectedNode