Auto Complete

This sample demonstrates using the ArcGIS Runtime SDK for WPF to perform a geometry operation that takes an input polyline graphic and makes a redline polygon graphic output.

To use the sample, connect the dots to create a polyline which defines a boundary for a new polygon. Double click the final dot (#3) to auto complete the polygon boundary.

In the code-behind, a LocalGeometryService is started. The url is passed into a GeometryService, which is used to takes the input polyline to attempt to make a closed polygon and if successful the output redline polygon graphic is returned.

Download Sample Application
XAML C# VB.NET
<UserControl x:Class="ArcGISWPFSDK.LocalAutoComplete"
    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>
            <esri:SimpleMarkerSymbol x:Key="BlackMarkerSymbol" Color="Black" Size="10" />
            <esri:SimpleLineSymbol x:Key="RedLineSymbol" Color="Red" Width="4" Style="Solid" />
            <esri:SimpleFillSymbol x:Key="BlueFillSymbol" Fill="#660000FF" BorderBrush="Blue" BorderThickness="2" />
            <esri:SimpleFillSymbol x:Key="RedFillSymbol" Fill="#66FF0000" BorderBrush="Red" BorderThickness="2" />
        </Grid.Resources>

        <esri:Map x:Name="MyMap" Extent="-15000000,2000000,-7000000,8000000" Background="#FFE3E3E3" IsEnabled="False">
            <esri:ArcGISLocalTiledLayer ID="BaseMap" Path="..\\Data\\TPKs\\Topographic.tpk"/>
            <esri:GraphicsLayer ID="ParcelsGraphicsLayer" x:Name="_parcelsGraphicsLayer"/>
            <esri:GraphicsLayer ID="CompletedGraphicsLayer" x:Name="_completedGraphicsLayer"/>
            <esri:GraphicsLayer ID="ConnectDotsGraphicsLayer">
                <esri:Graphic Symbol="{StaticResource BlackMarkerSymbol}">
                    <esri:MapPoint X="-12944384" Y="6804466" />
                    <esri:Graphic.MapTip>
                        <TextBlock Text="Click" FontSize="12" Foreground="White" >
                            <TextBlock.Effect>
                                 <DropShadowEffect Opacity="1" ShadowDepth="2"/>
                            </TextBlock.Effect>
                        </TextBlock>
                    </esri:Graphic.MapTip>
                </esri:Graphic>
                <esri:Graphic>
                    <esri:Graphic.Symbol>
                        <esri:TextSymbol FontFamily="Arial" FontSize="16" Foreground="Black" 
                                                Text="2" OffsetX="-5" OffsetY="15"/>
                    </esri:Graphic.Symbol>
                    <esri:MapPoint X="-12944384" Y="6804466"/>
                </esri:Graphic>
                <esri:Graphic Symbol="{StaticResource BlackMarkerSymbol}">
                    <esri:MapPoint X="-12834399" Y="6207201" />
                    <esri:Graphic.MapTip>
                        <TextBlock Text="Click" FontSize="12" Foreground="White" >
                            <TextBlock.Effect>
                                 <DropShadowEffect Opacity="1" ShadowDepth="2"/>
                            </TextBlock.Effect>
                        </TextBlock>
                    </esri:Graphic.MapTip>
                </esri:Graphic>
                <esri:Graphic>
                    <esri:Graphic.Symbol>
                        <esri:TextSymbol FontFamily="Arial" FontSize="16" Foreground="Black" 
                                                Text="1" OffsetX="-5" OffsetY="15" />
                    </esri:Graphic.Symbol>
                    <esri:MapPoint X="-12834399" Y="6207201" />
                </esri:Graphic>

                <esri:Graphic Symbol="{StaticResource BlackMarkerSymbol}">
                    <esri:MapPoint X="-11690605" Y="6154733" />
                    <esri:Graphic.MapTip>
                        <TextBlock Text="Double click" FontSize="12" Foreground="White" >
                            <TextBlock.Effect>
                                 <DropShadowEffect Opacity="1" ShadowDepth="2"/>
                            </TextBlock.Effect>
                        </TextBlock>
                    </esri:Graphic.MapTip>
                </esri:Graphic>
                <esri:Graphic>
                    <esri:Graphic.Symbol>
                        <esri:TextSymbol FontFamily="Arial" FontSize="16" Foreground="Black" 
                                                Text="3" OffsetX="-5" OffsetY="15" />
                    </esri:Graphic.Symbol>
                    <esri:MapPoint X="-11690605" Y="6154733" />
                </esri:Graphic>
            </esri:GraphicsLayer>
        </esri:Map>

        <Grid HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,10,10,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" />
            <TextBlock x:Name="ResponseTextBlock" Foreground="Black" Text="Connect the dots to create a polyline which defines a boundary for a new polygon.  Double click the final dot (#3) to auto complete the polygon boundary." 
                       Width="200" TextAlignment="Left" Margin="30,20,20,30" TextWrapping="Wrap" />
        </Grid>
    </Grid>
</UserControl>

Sample code usage restrictions
5/16/2014