Select to view content in your preferred language

Can I add a title and the legend when perform the print function?

1465
14
02-21-2011 10:41 AM
DanDong
Deactivated User
Hi all,

Is there a way to add a title and a legend to the map that I want to print? Right now I am able to print MyMap by using silverlight API.

Basically, right now, after hitting the print button, it will pop-up a window to choose the printer. I want to add a title to the map manually before this window popping up. Also the map should include the legend of the map with line shape (it represents...) and symbol (it represents....).

I dont know whether it is possible for silverlight by using API. Any suggestions? 🙂
0 Kudos
14 Replies
DominiqueBroux
Esri Frequent Contributor
After having defined the 'WithLegend' style in the resources of your control, you can set the style of the MapPrinter in XAML:
<userControls:WindowPanel x:Name="PrintDialogPanel" ContentTitle="PDF Printing" Collapsible="False" Closable="True" Minimized="False" Visibility="Collapsed">
<controls:MapPrinterDialog Height="410" Width="340">
<controls:MapPrinter x:Name="mapPrinter" Map="{Binding ElementName=MyMap}" Style="{StaticResource WithLegend}"/>
</controls:MapPrinterDialog>
</userControls:WindowPanel>
0 Kudos
ElizabethPianta
Deactivated User
Yes, that worked! I actually figured it out right after I posted the thread to you... and then felt ridiculous and rather embarassed for asking such a basic question:o
My swatches are indeed printing out on the legend now. Yoohoo!!! I have one last question to pose to you. I need to add datatables to the map printout as well. What is the best way to go about doing this?
Thank you again Dominique for the wonderful sample of the PDF print functionality that you have shared with the rest of the GIS community. Also, thank you very much for the prompt and efficient support that you have provided online for the developers. All your time and efforts are greatly appreciated:) Merci beaucoup!!!
0 Kudos
ElizabethPianta
Deactivated User
I never heard back on this issue. Can I also add a datagrid to the silverlight map printout when performing the print function?:(
0 Kudos
AmyAi
by
New Contributor
Hi,May you help me with the MapPrinterDialog?
I copy your the MapPrinterControl reference, WindowPanel.xaml and WindowPanel.xaml.cs to my own application, then I add these mark code in my xaml file
<mapControl:WindowPanel x:Name="MapPrinterDialogPanel" Width="340" Height="405"
          IsOpen="True" Visibility ="Collapsed"
          HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,60,10,0">
            
                <Printcontrols:MapPrinterDialog x:Name="MapPrinterDialog" Background="{StaticResource CommonBackgroundBrush}" Grid.Row="1">
                    <Printcontrols:MapPrinter x:Name="mapPrinterWithDialog" Map="{Binding ElementName=MyMap}" Title="�?��?�" PageChanged="mapPrinter_PageChanged"
            IsScaleFixed="True" Scale="2000000" />
                </Printcontrols:MapPrinterDialog>
            

            <mapControl:WindowPanel.ContentTitle  >
    <StackPanel Orientation="Horizontal" Height="20">
     <Image x:Name="prtDlgTitle"  Stretch="Fill" 
         Width="20" Height="20" Margin="5,0" />
     <TextBlock Foreground="White" FontSize="12" 
          Text="print" TextWrapping="NoWrap" VerticalAlignment="Center" />
    </StackPanel>
   </mapControl:WindowPanel.ContentTitle>
  </mapControl:WindowPanel>

In the sample, the WindowPanel.ContentTitle  is show, but in my application,the Title seems be workless. Can you tell where I should modify to show the contenttitle? Many thanks!
PS: My Application can work,print map, It is just unable to show the title and  to be dragged!
0 Kudos
DominiqueBroux
Esri Frequent Contributor
Maybe you forgot to add WindowsPanel.xaml as ResourceDictionary in Themes/generic.xaml.
0 Kudos