Using the _VisibilityChanged or _LegendChanged event to turn on/off a feature layer?

571
1
Jump to solution
09-09-2013 05:03 AM
YurongTan
Occasional Contributor
I have a feature layer that is derived from a dynamic map service layer solely for Map Tip purpose.  The feature layer is set to 100% transparent to fool the eyes of a user that the map tip appears to come from the "underlying dynamic map service layer". Is there a way to sycn the visibility of a map service layer with a derived feature layer using the _VisibilityChanged event or _LegendChanged event of the dynamic map service layer?  below is the codes, but none work.  What do I miss?  Thanks

private void ArcGISDynamicMapServiceLayer_LegendChanged(object sender, EventArgs e)
{
            FeatureLayer myFL = MyMap.Layers["Water info popup"] as FeatureLayer;
            DynamicMapServiceLayer myDMSL = MyMap.Layers["Water info station"] as DynamicMapServiceLayer;

            if (myDMSL.Visible == true) myFL.Visible = true;
            else myFL.Visible = false;
}

OR ...

private void ArcGISDynamicMapServiceLayer_LegendChanged(object sender, EventArgs e)
{
            FeatureLayer myFL = MyMap.Layers["Water info popup"] as FeatureLayer;
            DynamicMapServiceLayer myDMSL = MyMap.Layers["Water info station"] as DynamicMapServiceLayer;

            if (myDMSL.Visible == true) myFL.Visible = true;
            else myFL.Visible = false;
}
0 Kudos
1 Solution

Accepted Solutions
YurongTan
Occasional Contributor
Using the _PropertyChanged event solved the problem.

View solution in original post

0 Kudos
1 Reply
YurongTan
Occasional Contributor
Using the _PropertyChanged event solved the problem.
0 Kudos