Cannot create an instance of "MapPrinter"

965
5
Jump to solution
03-20-2013 05:38 AM
ShaningYu
Honored Contributor
Below is the piece of code in the MainPage.xaml. An error occurs at the colored piece in/ bold.

<!-- Printing Window -->
<userControls:WindowPanel x:Name="PrintWindow" Width="350" Grid.Row="1" Grid.Column="1" Height="450" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,100,0,0"
Visibility="Collapsed" Background="{StaticResource ProjectBackground2Tone}">
<StackPanel Orientation="Vertical" >
<printing:MapPrinterDialog Height="410" Width="340">
<printing:MapPrinter x:Name="mapPrinter" Map="{Binding ElementName=Map}" IsScaleFixed="False"/>
</printing:MapPrinterDialog>
</StackPanel>
<userControls:WindowPanel.ContentTitle>
<StackPanel Orientation="Horizontal">
<TextBlock FontSize="14" Foreground="White"
Text="Print Dialog" Width="400" TextWrapping="NoWrap" Height="Auto"
HorizontalAlignment="Left" TextAlignment="Left" Margin="5,5,5,5" />
</StackPanel>
</userControls:WindowPanel.ContentTitle>
</userControls:WindowPanel>

In this project, I use the MapPrintingControls.dll (Runtime version V2.050727). The exception error message is below:
Could not load file or assembly 'ESRI.ArcGIS.Client, Version=3.0.0.388, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86' or one of its dependencies. The system cannot find the file specified.
at ESRI.ArcGIS.Client.Samples.MapPrinting.MapPrinter..cctor()

How to debug it? Thanks.
0 Kudos
1 Solution

Accepted Solutions
ShaningYu
Honored Contributor
Problem solved.  I re-compiled the MapOrintingControls by referring updated version of the ESRI.ArcGIS.Client ESRI.ArcGIS.Client.Bing, then the problem was gone.

View solution in original post

0 Kudos
5 Replies
JohanCarlsson
Regular Contributor
It sounds like you haven't referenced ESRI.ArcGIS.Client and/or  ESRI.ArcGIS.Client.Samples.MapPrinting.MapPrinter in your project.
0 Kudos
ShaningYu
Honored Contributor
I need the ESRI.ArcGIS.Client.Samples.MapPrinting.dll.  Where can I get it?  Thanks.
0 Kudos
JohanCarlsson
Regular Contributor
If it is a sample you'll probably have to compile it on your own and use the resulting dll-files.
0 Kudos
ShaningYu
Honored Contributor
I downloaded the Sample project (ArcGISSilverlightSDK project), and then compiled.  However, no ESRI.ArcGIS.Client.Samples.dll is in the created files.  Please provide your advice how to do it if you can. 

Another Q related - In the MainPage.g.i.cs,
using ESRI.ArcGIS.Client.Samples.MapPrinting;
it is fine for this line of code.  In the MainPage.xaml file,
    xmlns:printing="clr-namespace:ESRI.ArcGIS.Client.Samples.MapPrinting;assembly=MapPrintingControls" 
But in the code below:
<printing:MapPrinter x:Name="mapPrinter" Map="{Binding ElementName=Map}" IsScaleFixed="False"/>
I got the error:  Cannot create an instance of "MapPrinter"

Thanks if you can help.
0 Kudos
ShaningYu
Honored Contributor
Problem solved.  I re-compiled the MapOrintingControls by referring updated version of the ESRI.ArcGIS.Client ESRI.ArcGIS.Client.Bing, then the problem was gone.
0 Kudos