Select to view content in your preferred language

Printing an InfoWindow

738
2
05-23-2012 07:41 AM
AdamFeidt
Occasional Contributor
I currently have code that allows our users to style and add text as a markup to a silverlight application.  It allows you to either add plain text or a callout via the InfoWindow control.  Our users love the InfoWindow solution, but would like to be able to include the InfoWindow labels when they print the map.  Currently, only the plain text (which is added to a graphics layer as opposed to the LayoutRoot Grid will print.  Is there any way to print an InfoWindow or replicate the InfoWindow as a graphic?

Code Behind:
                Dim _fontSize As Double = CType(TextSizeCB.SelectedValue, Double)
                Dim brush As New SolidColorBrush() With {.Color = CType(App.Current.Resources("mySolidColorBrushText"), SolidColorBrush).Color}
                Dim _textSymbol As New TextSymbol() With {.FontFamily = New FontFamily("Arial"), .Foreground = brush, .FontSize = _fontSize, .Text = TextInsertTB.Text}
                Dim _graphicText As New Graphic() With {.Geometry = New MapPoint(e.Geometry.Extent.XMax, e.Geometry.Extent.YMax), .Symbol = _textSymbol}
                _graphicText.Attributes("Label") = TextInsertTB.Text
                If CalloutCB.IsChecked Then
                    Dim _callout As New InfoWindow() With {.Anchor = New MapPoint(e.Geometry.Extent.XMax, e.Geometry.Extent.YMax), .Map = MyMap, .IsOpen = True, .Content = _graphicText.Attributes("Label"), .BorderBrush = brush, .Foreground = brush, .FontSize = _fontSize}
                    AddHandler _callout.MouseLeftButtonUp, AddressOf Callout_MouseLeftButtonUp
                    LayoutRoot.Children.Add(_callout)
                Else
                    Dim annotations As GraphicsLayer = TryCast(MyMap.Layers("TextGraphicsLayer"), GraphicsLayer)
                    annotations.Graphics.Add(_graphicText)
                End If
0 Kudos
2 Replies
JenniferNery
Esri Regular Contributor
Good question. Currently, we do not support this in v3.0 if you are asking about this print: http://resourcesbeta.arcgis.com/en/help/silverlight-api/samples/start.htm. I am not sure if the ArcGIS10.1 printing tool plan to support this in the future. I have not tried this but if you can get base64 string of the layer you can serialize it this way: http://serverapps101.esri.com/arcgis/sdk/rest/webmap_spec.html.


  //Client side image
  {
    "id": "<webmapOperationalLayerId1>",
    "url": "<url1>[?token=<tokenString1>",
    "title": "<title1>",
    "opacity": <opacity1>,
    "visibility": <true | false>,
    "minScale": <minScale1>,
    "maxScale": <maxScale1>,
    "extent": {
      "xmin": <xmin>,
      "ymin": <ymin>,
      "xmax": <xmax>,
      "ymax": <ymax>,
      "spatialReference": <spatialReference>
    },
    "imageData": "<base64 encoded image data>"
 
0 Kudos
AdamFeidt
Occasional Contributor
I'm using API 2.4 and SL 4.  I'm guessing I need to create a popup/InfoWindow graphic and add it to a graphicslayer to get it to print then?  If you have any other ideas please let me know.  Thank you for responding.
0 Kudos