Copy map to Clipboard
This sample shows a simple way to export the map as an image using the RenderTargetBitmap class in the System.Windows.Media.Imaging namespace.
Download Sample Application<UserControl x:Class="ArcGISWPFSDK.CopyToClipboard" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:esri="http://schemas.esri.com/arcgis/client/2009"> <Grid> <Grid.Resources> <LinearGradientBrush x:Key="PanelGradient" EndPoint="0.5,1" StartPoint="0.5,0"> <LinearGradientBrush.RelativeTransform> <TransformGroup> <ScaleTransform CenterY="0.5" CenterX="0.5"/> <SkewTransform CenterY="0.5" CenterX="0.5"/> <RotateTransform Angle="176" CenterY="0.5" CenterX="0.5"/> <TranslateTransform/> </TransformGroup> </LinearGradientBrush.RelativeTransform> <GradientStop Color="#FF145787" Offset="0.16"/> <GradientStop Color="#FF3D7FAC" Offset="0.502"/> <GradientStop Color="#FF88C5EF" Offset="0.984"/> </LinearGradientBrush> </Grid.Resources> <esri:Map x:Name="_map" UseAcceleratedDisplay="False"> <!-- Tiled Basemap Layer --> <esri:ArcGISLocalTiledLayer ID="Topographic USA" Path="..\Data\TPKs\Topographic.tpk"/> </esri:Map> <Grid HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,15,15,0" Width="275"> <Rectangle Fill="{StaticResource PanelGradient}" Stroke="Gray" RadiusX="10" RadiusY="10" Margin="0,0,0,5"> <Rectangle.Effect> <DropShadowEffect/> </Rectangle.Effect> </Rectangle> <Rectangle Fill="#DDFFFFFF" Stroke="DarkGray" RadiusX="5" RadiusY="5" Margin="5,5,5,10" /> <StackPanel Orientation="Vertical" Margin="10,10,10,10" HorizontalAlignment="Left" > <TextBlock Text="Click the button to copy the map to the system Clipboard. You can then paste the image into another application." TextWrapping="Wrap" HorizontalAlignment="Center" Foreground="Black" Margin="5,5,5,0"/> <Button Content="Copy To Clipboard" x:Name="CopytoClipboard" Click="CopytoClipboard_Click" VerticalAlignment="Top" HorizontalAlignment="Center" Height="auto" Width="auto" Margin="10"/> </StackPanel> </Grid> </Grid> </UserControl>
5/16/2014