Show Map Extent

This sample includes a Map and an ArcGISLocalTiledLayer and demonstrates how to handle extent changing and changed events on the map. Both events share the same event handler in code behind. The extent parameters of the map are display in a textblock as they change at runtime.

Download Sample Application
XAML C# VB.NET
<UserControl x:Class="ArcGISWPFSDK.LocalMapExtent"
    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">
        <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="MyMap" WrapAround="True" ExtentChanged="MyMap_ExtentChanged" ExtentChanging="MyMap_ExtentChanged" Extent="-15000000,2000000,-7000000,8000000" Background="#FFE3E3E3" MinimumResolution="2445.98490512499">
            <esri:ArcGISLocalTiledLayer ID="Shaded Relief" Path="..\\Data\\TPKs\\Topographic.tpk"/>
        </esri:Map>
        <Grid  HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,15,15,0" >
            <Rectangle Fill="{StaticResource PanelGradient}" Stroke="Gray"  RadiusX="10" RadiusY="10" Margin="0,0,0,5">
                <Rectangle.Effect>
                    <DropShadowEffect/>
                </Rectangle.Effect>
            </Rectangle>
            <Rectangle Fill="#FFFFFFFF" Stroke="DarkGray" RadiusX="5" RadiusY="5" Margin="10,10,10,15" />
            <StackPanel Orientation="Vertical" Margin="25">
                <StackPanel.Resources>
                    <Style TargetType="TextBlock">
                        <Setter Property="FontWeight" Value="Bold"/>
                        <Setter Property="FontSize" Value="11" />
                    </Style>
                </StackPanel.Resources>
                <TextBlock Foreground="Black">
          <Run FontStyle="Italic">Absolute</Run>
          <LineBreak />
          <Run>MinX: </Run>
          <Run Text="{Binding ElementName=MyMap, Path=Extent.XMin, StringFormat=\{0:F3\}}" />
          <LineBreak />
          <Run>MinY: </Run>
          <Run Text="{Binding ElementName=MyMap, Path=Extent.YMin, StringFormat=\{0:F3\}}" />
          <LineBreak />
          <Run>MaxX: </Run>
          <Run Text="{Binding ElementName=MyMap, Path=Extent.XMax, StringFormat=\{0:F3\}}" />
          <LineBreak />
          <Run>MaxY: </Run>
          <Run Text="{Binding ElementName=MyMap, Path=Extent.YMax, StringFormat=\{0:F3\}}" />               
          <LineBreak />
          <LineBreak />
          <Run FontStyle="Italic">Normalized</Run>
          <LineBreak />
          <Run>Left X: </Run>
          <Run x:Name="MinXNormalized" />
          <LineBreak />
          <Run>Bottom Y: </Run>
          <Run x:Name="MinYNormalized"/>
          <LineBreak />
          <Run>Right X: </Run>
          <Run x:Name="MaxXNormalized"/>
          <LineBreak />
          <Run>Top Y: </Run>
          <Run x:Name="MaxYNormalized"/>
                </TextBlock>
            </StackPanel>
        </Grid>
    </Grid>
</UserControl>

Sample code usage restrictions
5/16/2014