Select to view content in your preferred language

Trouble with CanExecute

786
1
10-31-2012 07:21 AM
KarenEllett
Regular Contributor
I'm trying to alter the relationship query example so that the tool is only enabled for a couple of specific layers.  I've tried several different ways of specifying it, but no luck.   return popupInfo.PopupItem.LayerName.ToString() == "MyLayerName"; etc.

Can anyone give me some help/examples? 
Thanks!
0 Kudos
1 Reply
JohanCarlsson
Regular Contributor
I'd recommend getting the layer type instead.

        public bool CanExecute(object parameter)
        {
            return MapApplication.Current.SelectedLayer is SomeLayerType;
        }


Alternatively you could get the layer name:
MapApplication.GetLayerName(yourLayer) == "the layer you want active";
0 Kudos