Hi,
I am having multiple map tools that can be opened from the Modify Features as well directly from the Ribbon tabs. Generally only one tool can be opened at one point of time but in some scenarios when one tool is opened from Ribbon tab and another from Modify Features two tools are opened at the same time.
Can we somehow close the Map Tool using a Daml Id or some other way?
Only one tool can be opened at the same time. If you activate one tool, it deactivates previous. Another thing if you open dockpane with tool activating. Then you must close/hide it your tool by overriding OnToolDeactivateAsync. EmbeddableControl pattern does it automatically.
@GKmieliauskas I cant use OnToolDeactivateAsync because we have created our own selection control which is a tool by itself. When our main tool is opened then we are making that selection tool as active which will call the OnToolDeactivateAsync already. So now when our main tool is closed actually it will not call OnToolDeactivateAsync. That's why I was looking for some other way. Quite tricky situation.
It is difficult to understand your situation without code, printscreens and etc.
@GKmieliauskas So basically my workflow is open the main map tool either from tab or from modify features. After main map tool is opened inside its embeddable control we have created our own selection control (which is also a map tool one of them is select rectangle) just like in any other Pro map tools. We are also setting that selection tool as active. In normal scenario if u do this the main tool should have been closed since one tool can be active at the same time. But we are making use of map tool property KeepLastToolActive. But now select tool is active which will call OnToolDeactivate of the main tool at that time only. Also since selection tool is active in the UI main tool is not checked or active because from the UI perspective it should have been main tool so for that we are programmatically setting Checked property of the main tool as false.
Now since the workflow is not straightforward as per Pro we have to do these workaround. In this workflow we are now facing a use case where two tools are seems to be selected. Because as per our logic main tool got opened and set active but then inside the selection tool got active but still from UI perspective we made the main tool as selected which we have done using pluginwrapper of the main tool. Then we are setting checked as false in the close but when are opening the other tool close method of previous tool not called which will make two tools as selected and active at the same time