Is there any event that I can subscribe to for seeing when the layer name is changed? I was hoping for something similar to LayersAddedEvent or LayersRemovedEvent.
You can use the MapMemberPropertiesChangedEvent class. The MapMemberPropertiesChangedEventArgs class has an "EventHint" property that can be used to find if the Name has changed.
Thanks
Uma
I have subscribed to this event but now have a slight issue that I don't understand. Do my code is this:
In the main form:
private void LayersChanged (MapMemberPropertiesChangedEventArgs obj)
{
cLayerSelection.RefreshLayerSelection();
}
Then in the cLayerSelect control I have:
public void RefreshLayerSelection() {
if (arcFac == null) return;
arcFac.GetLayers();
foreach (FeatureLayer fl in arcFac.LinkLayers)
layeritems.Add(fl);
foreach (FeatureLayer fl in arcFac.NodeLayers)
layeritems.Add(fl);
UpdateLayerGrid(); //this is a grid where the Items are set to the global variable layerItems
}
public void UpdateLayerGrid()
{
gridLayers.RefreshData(); //this throws an error 'System.InvalidOperationException' occurred ... The calling thread cannot access this object because a different thread owns it.
}
I call RefreshLayers from the LayersAddedEvent and LayersRemovedEvent and do not get this error. What is causing it?
Thank you,
Susan