Select to view content in your preferred language

How to toggle featurelayer visibility

2155
2
02-07-2011 08:10 AM
DonFreeman
Emerging Contributor
Can someone tell me how to toggle the featurelayer visibility (when a checkbox is checked in the legend)? I have found several examples using ArcGISDynamicMapServiceLayer, but how to do it with a FeatureLayer in C#?

Thanks
0 Kudos
2 Replies
SamuelDantas
Emerging Contributor
Just change the Visible property in your FeatureLayer.
0 Kudos
DonFreeman
Emerging Contributor
Just change the Visible property in your FeatureLayer.


Cool. My question had more to do with syntax. I found this works for me. Thanks
  public void AllToggle(object sender, EventArgs e)
   {
   CheckBox ckbx = sender as CheckBox;
   if (ckbx.Name == "AllAvailable_Checkbox" & ckbx.IsChecked == true)
    { 
    MyMap.Layers[1].Visible = true ;
    }
    else
    {
    MyMap.Layers[1].Visible = false;
    }
   }
0 Kudos