I added a new custom tree to TOC which looks like this:
IObjectClass
IFeature
IFeature ...
IObjectClass
IRow ...
made context menu using this sample http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#//00010000026q000000 and it shows up alright, but unfortunatelly its context menu commands are not doing anything. Here is onNodeMouseClick:
private void tvwSelected_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
m_contextItem = e.Node.Tag;
UID menuID = new UIDClass();
if (e.Node.Tag is IFeature)
menuID.Value = "{d32ae970-abb8-4f02-a592-9181f1307ed9}";
else
return;
ICommandBar cmdBar = (ICommandBar)_application.Document.CommandBars.Find(menuID, false, false);
cmdBar.Popup(0, 0);
}
}
and here is context menu:
public ContextMenuTest()
{
AddItem("esriCore.FeatureFindContextMenuItems", 1); //flash
AddItem("esriCore.FeatureFindContextMenuItems", 2); //zoom
AddItem("esriCore.FeatureFindContextMenuItems", 3); //identify
AddItem("esriCore.FeatureFindContextMenuItems", 6); //unselect
}
I believe the probblem could be that IFeature is not what these commands require, or the whole thing works in totaly different way. Any help would be appreciated.