ArcGIS Runtime SDK for WPF - Library Reference
CustomTextElements Property
See Also 
ESRI.ArcGIS.Client.Printing Namespace > LayoutOptions Class : CustomTextElements Property

Gets or sets the custom text elements. Optional but recommended when updating text of a TextElement (not DynamicText) on the page layout.

Syntax

Visual Basic (Declaration) 
Public Property CustomTextElements As IDictionary(Of String,String)
C# 
public IDictionary<string,string> CustomTextElements {get; set;}

Remarks

In order to programmatically change a generic Text Element in the marginalia of a map from the client, first a custom Layout Template must be created using ArcMap. The author of the Layout Template .mxd file must share with the developer the Element Name of the inserted Text Element so that this can be used in constructing the Dictionary that is passed to the Printing.LayoutOptions.CustomTextElements Property. The following is a screen shot of the Properties dialog for a Text Element that was added to the Layout View design surface of a Layout Template .mxd file (note that the Element Name is "MyCustomTextElement"):

A custom Text Element Properties dialog. Make sure and specify a value for the 'Element Name'.

And the corresponding code snippet to programmatically change the Text Element when using the PrintTask:

C#

            ESRI.ArcGIS.Client.Printing.PrintParameters myPrintParameters = new ESRI.ArcGIS.Client.Printing.PrintParameters(MyMap);
            ...
            ESRI.ArcGIS.Client.Printing.LayoutOptions myLayoutOptions = new ESRI.ArcGIS.Client.Printing.LayoutOptions();
            Dictionary<string, string> myCustomElements = new Dictionary<string, string>();
            
            // The "MyCustomTextElement" is the Element Name in the Layout Template .mxd file.
            myCustomElements.Add("MyCustomTextElement", "LOOK I CAN CHANGE THIS STRING");
            myLayoutOptions.CustomTextElements = myCustomElements;
            ...
            myPrintParameters.LayoutOptions = myLayoutOptions;
            

VB.NET

            Dim myPrintParameters As New ESRI.ArcGIS.Client.Printing.PrintParameters(MyMap)
            ...
            Dim myLayoutOptions As New ESRI.ArcGIS.Client.Printing.LayoutOptions
            Dim myCustomElements As New Dictionary(Of String, String)
            
            ' The "MyCustomTextElement" is the Element Name in the Layout Template .mxd file.
            myCustomElements.Add("MyCustomTextElement", "LOOK I CAN CHANGE THIS STRING")
            myLayoutOptions.CustomTextElements = myCustomElements
            ...
            myPrintParameters.LayoutOptions = myLayoutOptions
            

Property Value

The custom text elements.

Requirements

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

See Also

© ESRI, Inc. All Rights Reserved.