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

Gets the attribution template of an ArcGIS Server based ArcGISTiledMapServiceLayer 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 ArcGISTiledMapServiceLayer.

XAMLCopy Code
<Grid x:Name="LayoutRoot">
  
  <!-- Add a Map Control. -->
  <esri:Map Background="White" HorizontalAlignment="Left" Margin="0,180,0,0" Name="Map1" 
          VerticalAlignment="Top" Height="300" Width="400" >
  
    <!-- Define an ArcGISTiledMapServiceLayer. -->
    <esri:ArcGISTiledMapServiceLayer 
          Url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/PublicSafety/PublicSafetyBasemap/MapServer" />
    
  </esri:Map>
  
  <!-- 
  Add a Button to display ArcGISTiledMapServiceLayer 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="50" HorizontalAlignment="Left" Margin="406,200,0,0" Name="TextBox1" 
           VerticalAlignment="Top" Width="350" TextWrapping="Wrap" />
  
  <!-- ESRI Attribution Control  -->
  <sdk:Label Height="24" HorizontalAlignment="Left" Margin="406,265,0,0" Name="Label_Attribution" 
             VerticalAlignment="Top" Width="346" Content="ESRI Attribution Control:"/>
  <esri:Attribution HorizontalAlignment="Left" Margin="406,285,0,0" Name="Attribution1" 
                     VerticalAlignment="Top" Height="50" Width="350" />
  
  <!-- A ContentControl -->
  <sdk:Label Height="24" HorizontalAlignment="Left" Margin="405,341,0,0" Name="Label_ContentControl" 
             VerticalAlignment="Top" Width="346" Content="Content Control:"/>
  <ContentControl Height="30" HorizontalAlignment="Left" Margin="405,361,0,0" 
                  Name="ContentControl1" VerticalAlignment="Top" Width="351" 
                  FontSize="10"  Foreground="Green" />
  
  <!-- A Button -->
  <sdk:Label Height="24" HorizontalAlignment="Left" Margin="405,405,0,0" Name="Label_Button" 
             VerticalAlignment="Top" Width="346" Content="Button:"/>
  <Button Height="51" HorizontalAlignment="Left" Margin="405,429,0,0" 
          Name="Button1" VerticalAlignment="Top" Width="351" FontFamily="Webdings" />
  
  
  <!-- 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 ArcGISTiledMapServiceLayer.
  ESRI.ArcGIS.Client.ArcGISTiledMapServiceLayer myArcGISTiledMapServiceLayer = null;
  myArcGISTiledMapServiceLayer = (ESRI.ArcGIS.Client.ArcGISTiledMapServiceLayer)(Map1.Layers[0]);
  
  // Display the ArcGISTiledMapServiceLayer.CopyrightText in a TextBox.
  TextBox1.Text = myArcGISTiledMapServiceLayer.CopyrightText;
  
  // Display the ArcGISTiledMapServiceLayer.CopyrightText information via the ESRI Attribution Control.
  Attribution1.Layers = Map1.Layers;
  
  // Display the ArcGISTiledMapServiceLayer.CopyrightText information via a Microsoft ContentControl.
  ContentControl1.ContentTemplate = myArcGISTiledMapServiceLayer.AttributionTemplate;
  ContentControl1.Content = myArcGISTiledMapServiceLayer;
  
  // Display the ArcGISTiledMapServiceLayer.CopyrightText information via a Button.
  Button1.ContentTemplate = myArcGISTiledMapServiceLayer.AttributionTemplate;
  Button1.Content = myArcGISTiledMapServiceLayer;
}
VB.NETCopy Code
Private Sub ButtonAttributionTemplate_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
  
  ' Get the ArcGISTiledMapServiceLayer.
  Dim myArcGISTiledMapServiceLayer As ESRI.ArcGIS.Client.ArcGISTiledMapServiceLayer
  myArcGISTiledMapServiceLayer = CType(Map1.Layers.Item(0), ESRI.ArcGIS.Client.ArcGISTiledMapServiceLayer)
  
  ' Display the ArcGISTiledMapServiceLayer.CopyrightText in a TextBox.
  TextBox1.Text = myArcGISTiledMapServiceLayer.CopyrightText
  
  ' Display the ArcGISTiledMapServiceLayer.CopyrightText information via the ESRI Attribution Control.
  Attribution1.Layers = Map1.Layers
  
  ' Display the ArcGISTiledMapServiceLayer.CopyrightText information via a Microsoft ContentControl.
  ContentControl1.ContentTemplate = myArcGISTiledMapServiceLayer.AttributionTemplate
  ContentControl1.Content = myArcGISTiledMapServiceLayer
  
  ' Display the ArcGISTiledMapServiceLayer.CopyrightText information via a Button.
  Button1.ContentTemplate = myArcGISTiledMapServiceLayer.AttributionTemplate
  Button1.Content = myArcGISTiledMapServiceLayer
  
End Sub

Remarks

The AttributionTemplate Property returns a DataTemplate that allows for the display of the ArcGISTiledMapServiceLayer.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.