Load WebMap with Bing

This sample demonstrates adding data in a WebMap document housed via ArcGIS Online (http://www.arcgis.com) in a WPF application. The WebMap.GetMapAsync Method call takes a Globally Unique Identifier (GUID) for the WebMap service provided by ArcGIS Online to obtain the geographic data layers. The WebMap’s GetMapCompletedEventArgs.Map Property is used to add a Map Class to the WPF application for visual display. Since some of the geographic data layers used by the WebMap document consist of data provided by Microsoft Bing Map services, setting the WebMap.BingToken Property is required.

Download Sample Application
XAML C# VB.NET
<UserControl x:Class="ArcGISWPFSDK.LoadWebMapWithBing"
    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 x:Name="LayoutRoot" Background="#FFE3E3E3">
        <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>
            <Style x:Key="Link_Button" TargetType="Button">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="Button">
                            <TextBlock TextDecorations="Underline"> 
								<ContentPresenter/>
                            </TextBlock>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
                <Setter Property="Foreground" Value="Blue" />
                <Style.Triggers>
                    <Trigger Property="IsMouseOver" Value="true">
                        <Setter Property="Foreground" Value="Red" />
                    </Trigger>
                </Style.Triggers>
            </Style>
        </Grid.Resources>
        <Grid Name="BingKeyGrid" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,15,15,0">
            <Rectangle Stroke="Gray"  RadiusX="10" RadiusY="10" Fill="{StaticResource PanelGradient}" Margin="0,0,0,5" >
                <Rectangle.Effect>
                    <DropShadowEffect/>
                </Rectangle.Effect>
            </Rectangle>
            <Rectangle Fill="#DDFFFFFF" Stroke="DarkGray" RadiusX="5" RadiusY="5" Margin="10" />
            <StackPanel Orientation="Vertical" HorizontalAlignment="Center" Margin="20,20,20,20">
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="2" >
                    <TextBlock FontWeight="Bold" HorizontalAlignment="Center" Text="Enter Bing Key" Margin="2" Foreground="Black"/>
                    <Button Style="{StaticResource Link_Button}" Margin="2" Content="(Get Bing Key)" Click="Button_Click"/>
                </StackPanel>
                <TextBox x:Name="BingKeyTextBox" Width="250" HorizontalAlignment="Right" Margin="0,2,0,2" 
                        TextChanged="BingKeyTextBox_TextChanged"/>
                <TextBlock Name="InvalidBingKeyTextBlock" Text="Invalid Key" Foreground="Red"
                        Margin="0,2,0,2" HorizontalAlignment="Center" Visibility="Collapsed"/>
                <Button Name="LoadMapButton" Content="Load Map" Width="100" Margin="0,5,0,10" IsEnabled="False" 
                        HorizontalAlignment="Center" Click="LoadMapButton_Click" />
            </StackPanel>
        </Grid>
    </Grid>
</UserControl>

Sample code usage restrictions
5/16/2014