Select to view content in your preferred language

How to walk through the sublayers in a DynamicServiceLayer ...

1947
2
Jump to solution
01-28-2014 10:18 AM
YurongTan
Regular Contributor
I need to step through the sublayers of a composite dynamic layer (with several sublayers) and then set or change or modify the properties of individual sublayers through the VisibilityChanged.   Below are the codes I use.  there are three MessageBox lines.  The first one works, the second and third ones do NOT work (they are somehow ignored).  How do I get the properties of the sublayers?  What do I miss?  Is there a pointer or a sample out there that can be shared?  Thanks

private void ArcGISDynamicMapServiceLayer_VisibilityChanged(object sender, EventArgs e)
{
    DynamicLayerInfoCollection myDLIC = sender as DynamicLayerInfoCollection;
    ArcGISDynamicMapServiceLayer myDMSL = sender as ArcGISDynamicMapServiceLayer;
   
    // The line below works. 
    MessageBox.Show("Visibility Changed fired!  sender=" + sender.ToString() + "  e= " + e.ToString());

    // The two MessageBox lines are somehow ignored or not work at all
    MessageBox.Show("DMSL collection count = " + myDMSL.DynamicLayerInfos.Count().ToString());
    MessageBox.Show("DLIC collection count = " + myDLIC.Count().ToString());
}
0 Kudos
1 Solution

Accepted Solutions
YurongTan
Regular Contributor
Solution:
Make the sender as dynamic map service layer (DMSL) and implement the events of PropertyChanged and/or VisibilityChanged on the DMSL in combination with the SetVisibility and GetVisibility methods.  It still illusive in order to use those setting values to control some separate (feature) layer(s) derived directly from this main DMSL.  Cheers

View solution in original post

0 Kudos
2 Replies
YurongTan
Regular Contributor
Are there some ESRI folks out there who would like to step in for this? 

The main reason I am doing this is to be able to control MapTip that comes from a "FeatureLayer" derived from a sublayer of some composite ArcGISDynamicLayers.  Since the MapTip depends on the visibility of the derived FeatureLayer, a firing of MyLayer_ArcGISDynamicMapServiceLayer_PropertyChanged should allow one to set the visibility of the Featurelayer based on the visibility of the corresponding sublayer and therefore control the visibility of the MapTip.  Is there a workaround or a pointer?  Thanks
0 Kudos
YurongTan
Regular Contributor
Solution:
Make the sender as dynamic map service layer (DMSL) and implement the events of PropertyChanged and/or VisibilityChanged on the DMSL in combination with the SetVisibility and GetVisibility methods.  It still illusive in order to use those setting values to control some separate (feature) layer(s) derived directly from this main DMSL.  Cheers
0 Kudos