Display service metadata for Feature layers?

2296
3
05-13-2010 08:11 AM
TheresaKennedy
New Contributor II
Hi everyone,

Can anyone help me with how to display service metadata for a feature layer? I can easily access this information for a DynamicMapServiceLayer (using the Description and CopyrightText properties), but I can't do this for a feature layer. I need to both query and render my data, so I have to use a feature layer.

Has anyone else been able to do this? This xaml (from the layerlist sample) works splendidly for the ESRI dynamic service, and for my own DynamicMapServiceLayers, but not when I restrict it to an individual layer within the service. On the sublayer list sample, there is no discussion of metadata.

Thanks all!

sample code:

<ListBox x:Name="MyList" ItemsSource="{Binding Layers, ElementName=MyMap}" BorderBrush="#FF6C7E29">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">      
<!--Layer visibility checkbox-->     
<CheckBox IsChecked="{Binding Visible, Mode=TwoWay}" />    
<!--Layer name-->
<TextBlock Text="{Binding ID, Mode=OneWay}" Margin="5,0,0,0" >   
<!-- Tooltip on hover-->
<ToolTipService.ToolTip>
<StackPanel MaxWidth="400">      
<TextBlock FontWeight="Bold" Text="{Binding CopyrightText}" TextWrapping="Wrap" />
<TextBlock Text="{Binding Description}" TextWrapping="Wrap" />
</StackPanel>
</ToolTipService.ToolTip>
</TextBlock>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
0 Kudos
3 Replies
DominiqueBroux
Esri Frequent Contributor
For a featureLayer, Description and CopyrightText are given by the property layerInfo.

A tooltip like:
   <ToolTipService.ToolTip>
        <StackPanel MaxWidth="400">
            <TextBlock FontWeight="Bold" Text="{Binding CopyrightText}" TextWrapping="Wrap" />
            <TextBlock FontWeight="Bold" Text="{Binding LayerInfo.CopyrightText}" TextWrapping="Wrap" />
            <TextBlock Text="{Binding Description}" TextWrapping="Wrap" />
            <TextBlock Text="{Binding LayerInfo.Description}" TextWrapping="Wrap" />
        </StackPanel>
    </ToolTipService.ToolTip>

should work in this case.

/Dominique
0 Kudos
TheresaKennedy
New Contributor II
Thanks for the quick reply Dominique. I just tried adding your code including the layerInfo property, but nothing is showing up in my tooltip. I also can't find any info on LayerInfo.Description or CopyrightText on the resource center to help me. Any ideas?

Thanks again,

T
0 Kudos
DominiqueBroux
Esri Frequent Contributor
Which version of API are you working with?

I forgot to mention that LayerInfo property was only existing from version 2.0.
Links to documentation:
  LayerInfo property : http://help.arcgis.com/en/webapi/silverlight/apiref/topic316.html
  FeatureLayerInfo members : http://help.arcgis.com/en/webapi/silverlight/apiref/topic342.html

If you are using the version 2.0 and don't get any description for your feature layer, check that your service is giving such information. Example of service giving a description and a copyright : http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/0?...
0 Kudos