Select to view content in your preferred language

Measure Tool - How to switch units

1004
2
09-08-2011 07:45 AM
caseycupp
Deactivated User
Is there some documentation somewhere on using Units and switching between them.

I know there is a unit somewhere in the Spatial Reference.

What I'm trying to do is implement the Measure Tool, but give the user the option to switch Units.

casey
0 Kudos
2 Replies
JenniferNery
Esri Regular Contributor
0 Kudos
MichaelKohler
Frequent Contributor
I added combo boxes to my measure tool and bound the area and length for the esri:MeasureAction to the values in the combo boxes.


            <Border Style="{StaticResource MeasureBorder}" Padding="10,3,10,3" Opacity="0.8">
                <Border.Background>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#EE76A8D3" Offset="0"/>
                        <GradientStop Color="#EE5B8CB5" Offset="0.25"/>
                        <GradientStop Color="#EE363839" Offset="0.75"/>
                    </LinearGradientBrush>
                </Border.Background>
                <Border.Effect>
                    <DropShadowEffect />
                </Border.Effect>
                <StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <Image Source="Images/i_measure.png" Height="15" Width="15"/>
                        <TextBlock Text="Measure Tool" Foreground="White" FontWeight="Bold" Margin="5,0,0,0"/>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <ComboBox x:Name="AreaMeasureUnit" SelectedIndex="0">
                            <ComboBoxItem Content="Acres"/>
                            <ComboBoxItem Content="SquareFeet"/>
                            <ComboBoxItem Content="SquareMiles"/>
                        </ComboBox>
                        <ComboBox x:Name="LengthMeasureUnit" SelectedIndex="0">
                            <ComboBoxItem Content="Feet"/>
                            <ComboBoxItem Content="Miles"/>
                        </ComboBox>
                    </StackPanel>
                    <Button Style="{StaticResource MenuItem}"                             
                            Content="Click to Measure"  >
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="Click">
                                <esri:MeasureAction                                  
                                    AreaUnit="{Binding ElementName=AreaMeasureUnit, Path=SelectedItem.Content}" 
                                    DisplayTotals="True"
                                    DistanceUnit="{Binding ElementName=LengthMeasureUnit, Path=SelectedItem.Content}"
                                    MapUnits="DecimalDegrees"
                                    MeasureMode="Polygon"                                   
                                    FillSymbol="{StaticResource MeasureFillSymbol}"
                                    TargetName="MyMap"/>
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                    </Button>

                </StackPanel>
0 Kudos