Hi -I took the Legend with Templates sample and added a button to it that lists the VisibleLayers property of the US layer.When I first start the app it is null, even though some of the layers are checked.If I toggle a sublayer it seems to synch for this sample. But for another app it doesn't ever synch.private void ListVisibleLayers_Click(object sender, RoutedEventArgs e)
{
try
{
var dynLayer = MyMap.Layers["United States"] as ArcGISDynamicMapServiceLayer;
if (dynLayer.VisibleLayers == null)
{
MessageBox.Show("null visiblelayers property");
}
else
{
var sb = new System.Text.StringBuilder();
foreach (int id in dynLayer.VisibleLayers)
sb.AppendLine(id.ToString());
MessageBox.Show(sb.ToString());
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}