ArcGIS API for WPF - Library Reference
AttributionTemplate Property
See Also  Example Send comments on this topic
ESRI.ArcGIS.Client Namespace > ArcGISDynamicMapServiceLayer Class : AttributionTemplate Property

Gets the attribution template of an ArcGIS Server based ArcGISDynamicMapServiceLayer web service.

Syntax

Visual Basic (Declaration) 
Public ReadOnly Property AttributionTemplate As DataTemplate
C# 
public DataTemplate AttributionTemplate {get;}

Example

How to use:

Click the 'Display Copyright and AttributionTemplate Information' Button to display CopyrightText information in various controls. The purpose is to demonstrate what is contained in the AttributionTemplate is the same as the CopyrightText.

The XAML code in this example is used in conjunction with the code-behind (C# or VB.NET) to demonstrate the functionality.

The following screen shot corresponds to the code example in this page.

Showing the CopyrightText of an ArcGISDynamicMapServiceLayer.

XAMLCopy Code
<Grid x:Name="LayoutRoot">
  
  <!-- Add a Map Control. Set it's Initial Extent to Texas. -->
  <esri:Map Background="White" HorizontalAlignment="Left" Margin="0,180,0,0" Name="Map1" 
          VerticalAlignment="Top" Height="300" Width="400" Extent="-107.45,25.62,-92.80,36.60">
  
    <!-- Define an ArcGISDynamicMapServiceLayer. -->
    <esri:ArcGISDynamicMapServiceLayer 
          Url="http://sampleserver1.arcgisonline.com:80/arcgis/rest/services/Specialty/ESRI_StateCityHighway_USA/MapServer" />
    
  </esri:Map>
  
  <!-- 
  Add a Button to display ArcGISDynamicMapServiceLayer CopyrightText and AttributeTemplate
  Property information. Both Properties display the same information. 
  -->
  <Button Content="Display Copyright and AttributionTemplate Information" Height="23" 
          HorizontalAlignment="Left" Margin="12,151,0,0" Width="763" VerticalAlignment="Top" 
          Name="ButtonAttributionTemplate" Click="ButtonAttributionTemplate_Click"/>
  
            
  <!-- A TextBox -->
  <sdk:Label Height="24" HorizontalAlignment="Left" Margin="406,179,0,0" Name="Label_CopyrightText" 
             VerticalAlignment="Top" Width="350" Content="TextBox:"/>
  <TextBox Height="30" HorizontalAlignment="Left" Margin="406,200,0,0" Name="TextBox1" 
           VerticalAlignment="Top" Width="350" />
  
  <!-- ESRI Attribution Control  -->
  <sdk:Label Height="24" HorizontalAlignment="Left" Margin="410,256,0,0" Name="Label_Attribution" 
             VerticalAlignment="Top" Width="346" Content="ESRI Attribution Control:"/>
  <esri:Attribution HorizontalAlignment="Left" Margin="406,279,0,0" Name="Attribution1" 
                     VerticalAlignment="Top" Height="30" Width="350" />
  
  <!-- A ContentControl -->
  <sdk:Label Height="24" HorizontalAlignment="Left" Margin="410,341,0,0" Name="Label_ContentControl" 
             VerticalAlignment="Top" Width="346" Content="Content Control:"/>
  <ContentControl Height="30" HorizontalAlignment="Left" Margin="410,361,0,0" 
                  Name="ContentControl1" VerticalAlignment="Top" Width="346" 
                  FontSize="20"  Foreground="Red" />
  
  <!-- A Button -->
  <sdk:Label Height="24" HorizontalAlignment="Left" Margin="410,424,0,0" Name="Label_Button" 
             VerticalAlignment="Top" Width="346" Content="Button:"/>
  <Button Height="30" HorizontalAlignment="Left" Margin="410,448,0,0" 
          Name="Button1" VerticalAlignment="Top" Width="346" />
  
  
  <!-- Provide the instructions on how to use the sample code. -->
  <TextBlock Height="52" HorizontalAlignment="Left" Name="TextBlock1" VerticalAlignment="Top" Width="756" TextWrapping="Wrap" 
       Text="Click the 'Display Copyright and AttributionTemplate Information' Button to display CopyrightText information 
             in various controls. The purpose is to demonstrate what is contained in the AttributionTemplate is the
             same as the CopyrightText." />
  
</Grid>
C#Copy Code
private void ButtonAttributionTemplate_Click(object sender, System.Windows.RoutedEventArgs e)
{
  // Get the ArcGISDynamicMapServiceLayer.
  ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer myArcGISDynamicMapServiceLayer = null;
  myArcGISDynamicMapServiceLayer = (ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer)(Map1.Layers[0]);
  
  // Display the ArcGISDynamicMapServiceLayer.CopyrightText in a TextBox.
  TextBox1.Text = myArcGISDynamicMapServiceLayer.CopyrightText;
  
  // Display the ArcGISDynamicMapServiceLayer.CopyrightText information via the ESRI Attribution Control.
  Attribution1.Layers = Map1.Layers;
  
  // Display the ArcGISDynamicMapServiceLayer.CopyrightText information via a Microsoft ContentControl.
  ContentControl1.ContentTemplate = myArcGISDynamicMapServiceLayer.AttributionTemplate;
  ContentControl1.Content = myArcGISDynamicMapServiceLayer;
  
  // Display the ArcGISDynamicMapServiceLayer.CopyrightText information via a Button.
  Button1.ContentTemplate = myArcGISDynamicMapServiceLayer.AttributionTemplate;
  Button1.Content = myArcGISDynamicMapServiceLayer;
}
VB.NETCopy Code
Private Sub ButtonAttributionTemplate_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
  
  ' Get the ArcGISDynamicMapServiceLayer.
  Dim myArcGISDynamicMapServiceLayer As ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer
  myArcGISDynamicMapServiceLayer = CType(Map1.Layers.Item(0), ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer)
  
  ' Display the ArcGISDynamicMapServiceLayer.CopyrightText in a TextBox.
  TextBox1.Text = myArcGISDynamicMapServiceLayer.CopyrightText
  
  ' Display the ArcGISDynamicMapServiceLayer.CopyrightText information via the ESRI Attribution Control.
  Attribution1.Layers = Map1.Layers
  
  ' Display the ArcGISDynamicMapServiceLayer.CopyrightText information via a Microsoft ContentControl.
  ContentControl1.ContentTemplate = myArcGISDynamicMapServiceLayer.AttributionTemplate
  ContentControl1.Content = myArcGISDynamicMapServiceLayer
  
  ' Display the ArcGISDynamicMapServiceLayer.CopyrightText information via a Button.
  Button1.ContentTemplate = myArcGISDynamicMapServiceLayer.AttributionTemplate
  Button1.Content = myArcGISDynamicMapServiceLayer
  
End Sub

Remarks

The AttributionTemplate Property returns a DataTemplate that allows for the display of the ArcGISDynamicMapServiceLayer.CopyrightText information.

The typical use case is to use an ESRI Attribution Control where the Map.Layers Property is bound to the Attribution.Layers Property. This will enable the display of the CopyrightText information about various layers in a nicely formatted output with minimal programming effort. The ease of use for this use case becomes readily apparent when there are multiple layers with CopyrightText information that need to be displayed and only a single binding needs to take place. Note: All layers that have an AttributionTemplate Property have the IAttribution Interface implemented.

The AttributionTemplate is read-only and is only useful to display the CopyrightText information. It is not possible to set the CopyrightText information on the client side nor is it possible to change the internals of the DataTemplate obtained by the AttributionTemplate.

Any Control that has a ContentTemplate Property can display the information contained in the AttributionTemplate. These Controls can have their base Properties modified to alter the appearance of the CopyrightText information being displayed (i.e. FontSize, Foreground, etc.). When multiple layers have CopyrightText information that needs attributed, it takes more complex programming logic to display the information; consider using the ESRI Attribution Control instead.

Requirements

Target Platforms: Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© ESRI, Inc. All Rights Reserved.