I am trying to figure out how the draw object behaving. When we have multiple objects that are working on one map and we set one to be enabled, do all the other ones disable? It seems to be behaving that way, but I didn't find anything in the API about it.
MyMeasureObject = new Draw(map)
{
LineSymbol = MeasureCanvas.Resources["DrawLineSymbol"] as LineSymbol,
FillSymbol = MeasureCanvas.Resources["DrawFillSymbol"] as FillSymbol
};
So for example here, lets say I enable MyMeasureObject. Any other draw objects that were enabled on map will no long be active. Is that correct? Are they supposed to go to disabled?
That is correct only one Draw object is enabled at a time. Even though you may have multiple instances of Draw. For example, Editor.Add, Editor.Select, Editor.Cut, Editor.Reshape, Editor.Union, TemplatePicker, EditorWidget, Measure, etc. - activating one of these will deactivate the current Draw object. This is by design.
I have been working with a similar issue: we have a custom toolbar and we would like to disable the current draw object of the map when the user selects a tool from our toolbar, but we don't know how to do this. Note: the toolbar is a separate dll, so it doesn't "know" the name of the draw object that needs to be disabled. It should be able to disable any draw object that might be active on the map.
Any ideas? Should we start up a dummy-Editor and use its functions to deactivate any possible draw object? Or is there a way to somehow get a handle on the current draw object (through the parent map object or something)?
Nevermind my previous message. I checked again the documentation for Draw, which clearly says
"If one Draw object is activated while another Draw object is already active, the second Draw object will be automatically deactivated."
I then checked our code and realized, that one of the tools in the toolbar didn't use a Draw object and of course this was the tool I had tested with. So, activating and deactivating a new draw surface also when this tool is selected did the trick.