How can I programmatically start the (Edit) Annotation Tool in Modify Features? I have not been able to find a combination of a DAML id and Framework method that launches the Annotation Tool in the Tools section of the Edit tab.
Solved! Go to Solution.
Les,
I'm assuming that the problem you are running into is because of your assumption that the annotation "tool" as you call it is. in fact, a "Tool" - as in Framework.Contracts.Tool.....which it isn't 😉
It's a button (or "ICommand" as we would have called it if we were in ArcObjects).
Add this code I provide below to a button and set a breakpoint on the "if (plugin is Tool)" line...notice it returns false....meaning "SetCurrentToolAsync", if you were to call it, will be a no-op - it will do nothing.
Instead, the code will drop down to "plugin.Execute" which will do what I think you want....it will show the Annotation dockpane and activate the underlying annotation text tool. Note: ICommand is a System.Windows.Input.ICommand - you will need a "using" statement accordingly.
var plugin = FrameworkApplication.GetPlugInWrapper("esri_editing_EditVerticesText");
if (plugin.Enabled) {
if (plugin is Tool)
{
FrameworkApplication.SetCurrentToolAsync("esri_editing_EditVerticesText");
}
else
{
((ICommand)plugin).Execute(null);
}
}
Les,
I'm assuming that the problem you are running into is because of your assumption that the annotation "tool" as you call it is. in fact, a "Tool" - as in Framework.Contracts.Tool.....which it isn't 😉
It's a button (or "ICommand" as we would have called it if we were in ArcObjects).
Add this code I provide below to a button and set a breakpoint on the "if (plugin is Tool)" line...notice it returns false....meaning "SetCurrentToolAsync", if you were to call it, will be a no-op - it will do nothing.
Instead, the code will drop down to "plugin.Execute" which will do what I think you want....it will show the Annotation dockpane and activate the underlying annotation text tool. Note: ICommand is a System.Windows.Input.ICommand - you will need a "using" statement accordingly.
var plugin = FrameworkApplication.GetPlugInWrapper("esri_editing_EditVerticesText");
if (plugin.Enabled) {
if (plugin is Tool)
{
FrameworkApplication.SetCurrentToolAsync("esri_editing_EditVerticesText");
}
else
{
((ICommand)plugin).Execute(null);
}
}
Thanks so much!. I had tried that DAML id as you mentioned as a "tool" with SetCurrentToolAsync(). I had also tried using an ICommand at one point but must have had the wrong DAML id.