But, in order to get/set the visibility of its sublayer it takes Layerid as an argument which is not public. The question here is how can I use this method unless I have the Layerid.SetLayerVisibility(int layerID, bool visible);Same is the issue with MaximumScale and MinimumScale. Please suggest me a proper way to handle this situation.
How exactly do you set the visibility of WMS sub layer using Wms.Layers property?
The 'Layers' property is of type string[].
You can set it in XAML though a comma separated layer list:
<esri:WmsLayer Layers="layer1,layer2" .....
or in C# by code like:
wmsLayer.Layers = new[] { "layer1", "layer2"};
If you need to know dynamically the list of layers supported by the service you can use the LayerList property
Thanks Dominique - I can add the WMS successfully, using
<esri:WmsLayer Layers="layer1,layer2"
.. but default visibility on the WMS sub layers is false.
How do I programmatically turn on visibility for a WMS sub layer in c#?
Visibility of WMS layers should be depending on the list of Layers you set.
From the moment you set Layers to "layer1, layer2", these sublayers should be visible (and all ascendants and descendants as well if you are working with a hierarchy of sublayers).
You should be able to observe that by setting up a legend control that displays the sub layers visibility such as in this sample.
In synthesis:
- to change programmatically the layer visibilities --> set the 'Layers' property
- to change interactively these visibilities --> use the legend control
サインインしたメンバーは投稿、更新のフォローなどができます。初めてですか?無料アカウントを登録してください。
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.