You have several options and these may not include all. I suggest you try them out and find a design that fits your need.You can start your map with ArcGISDynamicMapServiceLayer, setting its VisibleLayers to exclude FeatureLayer's you want to turn off, when Legend control updates a sublayer visibility to true, you can create a FeatureLayer. You can start your map with FeatureLayers Visible=False and let Legend control update each layer visibility. If the concern here is getting features before the layer is Visible, you can set FeatureLayer.Where="1 != 1" to ensure no features are returned when the layer is not visible. When layer becomes visible, FeatureLayer.Where="1=1" to query all features and call FeatureLayer.Update(). Or you can set Mode=SelectionOnly while its Visible=False and Mode=OnDemand when Visible=True, and call FeatureLayer.Update().
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.