The following shows how to find the top item in the displayed tree for a selected item in an extension view. This is applicable to item-view extensions.



public IswItem GetTopItem()
{
    var currentNodePath = _host.GetCurrentNodePath();

    if (currentNodePath.Count > 0)
        return currentNodePath[0].Owner;

    else
        return _currentItem;
}


Assuming that _currentItem is the currently selected item in the tree and _host is your IswItemViewHost.