Change viewpoint

This sample demonstrates different ways in which you can change the viewpoint or visible area of the map.

Change viewpoint

Instructions

Click any of the available buttons to change the current viewpoint

Code

<UserControl 
    x:Class="ArcGISRuntime.WPF.Samples.ChangeViewpoint.ChangeViewpoint"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013" 
    mc:Ignorable="d" 
    d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <esri:MapView x:Name="MyMapView">
            <esri:Map>
                <esri:ArcGISTiledLayer x:Name="Basemap"
                    Source="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"/>
            </esri:Map>
        </esri:MapView>
        <Border Name="uiPanel" 
                Background="White" BorderBrush="Black" BorderThickness="1"
                HorizontalAlignment="Right" VerticalAlignment="Top"
                Margin="30" Padding="20" Width="375">
            <StackPanel>
                <TextBlock Text="Select one of the buttons to run the related Viewpoint code"
                           HorizontalAlignment="Center"
                           Margin="0,0,0,2" 
                           TextWrapping="Wrap" />
                <WrapPanel Grid.Row="0" Grid.Column="0" HorizontalAlignment="Center">
                    <Button Content="Geometry"
		                HorizontalAlignment="Left"
		                Margin="10,10,0,0"
                        Padding="4"    
		                VerticalAlignment="Top"
		                Width="Auto"
		                Click="OnButtonClick" 
                        ToolTip="Sets Viewpoint to a predefined Polygon's extent"/>
                    <Button Content="Center and Scale"
		                HorizontalAlignment="Center"
		                Margin="10,10,0,0"
                        Padding="4"
		                VerticalAlignment="Top"
		                Width="Auto"
		                Click="OnButtonClick"
                        ToolTip="Sets Viewpoint a predefined point and scale"/>
                    <Button Content="Animate"
		                HorizontalAlignment="Right"
		                Margin="10,10,0,0"
                        Padding="4"
		                VerticalAlignment="Top"
		                Width="Auto"
		                Click="OnButtonClick"
                        ToolTip="Sets Viewpoint and animate repositioning of view"/>
                </WrapPanel>
            </StackPanel>
        </Border>
    </Grid>
</UserControl>


In this topic
  1. Instructions
  2. Code