Select to view content in your preferred language

Suggestion: Add LayerInfo.Visibility property to set visibility of sublayer directly

1151
4
08-28-2011 05:29 AM
wangzhifang
Occasional Contributor
For now, the only way to control sublayer's visibility of a ArcGISDynamicMapService is to set its VisibleLayers property(http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#SubLayerList).
And on LayerInfo class, there is only a DefualtVisibility property(http://help.arcgis.com/en/webapi/silverlight/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.LayerInfo~...), which is readonly.
I thought if is there any possibility to add a Visibility property to LayerInfo class, so we could directly control each sublayer's visibility in a dynamic map service, as well as convenience for a twoway binding?
0 Kudos
4 Replies
JenniferNery
Esri Regular Contributor
I'm not sure I understand, you want the client app to update visibility on the server? If yes, I think this is a request you may want to post in the ArcGIS Server team.

In the SubLayerList sample, you need not make every sub layer show by default. ArcGISDynamicMapServiceLayer.VisibleLayers can be an empty int[] {} that can be updated everytime a checkbox has been checked.
0 Kudos
wangzhifang
Occasional Contributor
I'm not sure I understand, you want the client app to update visibility on the server? If yes, I think this is a request you may want to post in the ArcGIS Server team.

In the SubLayerList sample, you need not make every sub layer show by default. ArcGISDynamicMapServiceLayer.VisibleLayers can be an empty int[] {} that can be updated everytime a checkbox has been checked.

Hi jennifer, what I mean is not to update the state of the map service on the server, but just control the exact sublayer's visibility on client side.
I guess because of the exportmap operation of the REST sdk, so the behavior to control a sublayer's visibility is due to control of an int array of visible layers. But this is not convenient for binding. If there is additional Visibility dependencypropery on LayerInfo class, we could just control a sublayer's visibility by directly binding a checkbox on UI, rather than writing additional code in .cs file.
Maybe in the setter of Visibility denpendencyproperty, construct a new array of visible layers and refresh the Layer is ok.
Just a suggestion, don't know if it's worth to do this. 🙂
0 Kudos
JenniferNery
Esri Regular Contributor
Ah that means you only need to tweak the SDK sample a little bit. I've had this sample for awhile, kindly see attached. The client app will not have any layer visible sub layer until the checkbox is clicked.
0 Kudos
wangzhifang
Occasional Contributor
Ah that means you only need to tweak the SDK sample a little bit. I've had this sample for awhile, kindly see attached. The client app will not have any layer visible sub layer until the checkbox is clicked.


Hi Jennifer, you must misunderstood what I try to say originally. What I suggested is to use a sublayer(LayerInfo)'s property in binding to control its visibility, but without any code behind. Just don't know if it's worth to do it in API level.
Anyway, I've learned your example and really appreciate your project.
0 Kudos