ArcGIS Runtime SDK for .NET Samples

Format coordinates

Format geographic coordinates
Loading

Code

<UserControl x:Class="ArcGISRuntime.WPF.Samples.FormatCoordinates.FormatCoordinates"
             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/runtime/2013">
    <UserControl.Resources>
        <Style TargetType="TextBlock">
            <Setter Property="Margin" Value="0,5,5,0" />
        </Style>
        <Style TargetType="TextBox">
            <Setter Property="Margin" Value="0,5,0,0" />
        </Style>
    </UserControl.Resources>
    <Grid>
        <esri:MapView x:Name="MyMapView" />
        <Border BorderBrush="Black" BorderThickness="1" Background="White"
                HorizontalAlignment="Right" VerticalAlignment="Top"
                Margin="30" Padding="20" Width="375">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <TextBlock
                    Text="Tap on the map to see the coordinates in each format. Update any value and select 'Recalculate' to see the updated coordinates."
                    Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2"
                    Margin="0,0,0,0"
                    TextWrapping="Wrap" FontWeight="SemiBold" />
                <TextBlock Text="Decimal Degrees"
                           Grid.Row="1" Grid.Column="0"
                           HorizontalAlignment="Right" />
                <TextBox x:Name="DecimalDegreesTextField"
                         Grid.Row="1" Grid.Column="1"
                         Tag="Decimal Degrees" />
                <TextBlock Text="Degrees, Minutes, Seconds"
                           Grid.Row="2" Grid.Column="0"
                           HorizontalAlignment="Right" />
                <TextBox x:Name="DmsTextField"
                         Grid.Row="2" Grid.Column="1"
                         Tag="Degrees, Minutes, Seconds" />
                <TextBlock Text="UTM"
                           Grid.Row="3" Grid.Column="0"
                           HorizontalAlignment="Right" />
                <TextBox x:Name="UtmTextField"
                         Grid.Row="3" Grid.Column="1"
                         Tag="UTM" />
                <TextBlock Text="USNG"
                           Grid.Row="4" Grid.Column="0"
                           HorizontalAlignment="Right" />
                <TextBox x:Name="UsngTextField"
                         Grid.Row="4" Grid.Column="1"
                         Tag="USNG" />
                <Button Content="Recalculate"
                        Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="2"
                        Margin="0,5,0,0"
                        Click="RecalculateFields" />
            </Grid>
        </Border>
    </Grid>
</UserControl>


In this topic
  1. Code