Select to view content in your preferred language

layerLegendInfo.LayerDescription is always null

3831
3
01-06-2014 07:56 AM
Matrix_Solutions_Inc_Geomatics
Regular Contributor
Hi,

I am trying to bind to the
LegendItemViewModel.Description
property but the value never shows up or defaults to the Map Services description. Yet all the other property values exists.

<DataTemplate x:Key="LayerTemplate">
        <StackPanel  Margin="0,-1" Orientation="Horizontal" >
            <ToolTipService.ToolTip>
                <StackPanel MaxWidth="400">
     <TextBlock FontWeight="Bold" Text="{Binding Path=Layer.ID }" TextWrapping="Wrap" />
     <TextBlock FontWeight="Bold" Text="{Binding Path=Label}" TextWrapping="Wrap" />
     <TextBlock Text="{Binding Path=Description}" />
                    <TextBlock Text="{Binding Path=SubLayerID, StringFormat='SubLayer ID : {0}'}" />
                </StackPanel>
            </ToolTipService.ToolTip>


I debugged where the value gets set in LayerItemViewModel...

       
  internal LayerItemViewModel(Layer layer, LayerLegendInfo layerLegendInfo, string defaultLayerDescription, Map map)
   : this(layer)
  {
   Debug.Assert(layerLegendInfo != null);
   Debug.Assert(map != null); // Needed to convert scale to resolution

   SubLayerID = layerLegendInfo.SubLayerID;
   Label = layerLegendInfo.LayerName;
   ParentLabel = layer.DisplayName ?? layer.ID;
   LayerType = layerLegendInfo.LayerType;
   IsHidden = layerLegendInfo.IsHidden;
   if (string.IsNullOrEmpty(layerLegendInfo.LayerDescription))
    Description = defaultLayerDescription;
   else
    Description = layerLegendInfo.LayerDescription;


and it seems that layerLegendInfo.LayerDescription is always null.

I should add that this is a 10.0 service.
0 Kudos
3 Replies
DominiqueBroux
Esri Frequent Contributor
LayerItemViewModel.LayerDescription is populated from the description coming from the layer metadata.

Did you check that your service has a description?

From this sample, it looks like the description is correctly set (you can see the layer description in the legend layer item tooltip).
0 Kudos
Matrix_Solutions_Inc_Geomatics
Regular Contributor

Sorry for the late reply, but LayerDescription returns the service description as it does in the example you have provided, not the description given to that particular feature layer.

Also, after scouring the LayerInfo for sub-layers during run time the LayerDescription object is always null.

The rest api doesn't seem to return the descriptions for the layers when doing a call to the map service.

0 Kudos
Matrix_Solutions_Inc_Geomatics
Regular Contributor

Dominique Broux

Basically, I need to execute a ArcGISDynamicMapServiceLayer.GetAllDetails() so that I can populate the sub layers with the returned FeatureLayerInfo objects, specifically the layer descriptions.

Unless I've completely missed something about the ArcGISDynamicMapServiceLayer to tell it to return the FeatureLayerInfos on its own, which it doesn't seem to currently do.

0 Kudos