Hi,
We are currently dealing with multiple Map Frames, but only one Map Frame should have the Add Data option enabled, while for the others it should be disabled so that users cannot add data from external sources to the other Map Frames except one.
Below is the button I have to disable it for other Map Frames.
Is anyone aware of a way to accomplish this?
Thanks in advance!
Solved! Go to Solution.
Add a custom condition for "canaddlayers_condition", with a "canaddlayers_state".
Add a button wired to the canaddlayers_condition. Delete Esri's addData button, and insert your own adddata button. Wire your button to use the Browse snippet when it's clicked.
Override the Initialize in your module to subscribe to active map view change event.
protected override bool Initialize()
{
ActiveMapViewChangedEvent.Subscribe((ea) =>
{
string stateID = "canaddlayers_state";
if (ea.IncomingView?.Map.Name == "Map1")
FrameworkApplication.State.Activate(stateID);
else
FrameworkApplication.State.Deactivate(stateID);
Trace.WriteLine("changed");
});
return base.Initialize();
}
When I activate/deactivate Map1, the button gets activated/deactivated.
Add a custom condition for "canaddlayers_condition", with a "canaddlayers_state".
Add a button wired to the canaddlayers_condition. Delete Esri's addData button, and insert your own adddata button. Wire your button to use the Browse snippet when it's clicked.
Override the Initialize in your module to subscribe to active map view change event.
protected override bool Initialize()
{
ActiveMapViewChangedEvent.Subscribe((ea) =>
{
string stateID = "canaddlayers_state";
if (ea.IncomingView?.Map.Name == "Map1")
FrameworkApplication.State.Activate(stateID);
else
FrameworkApplication.State.Deactivate(stateID);
Trace.WriteLine("changed");
});
return base.Initialize();
}
When I activate/deactivate Map1, the button gets activated/deactivated.