Edit Tools - Auto Save

This sample demonstrates using the ESRI.ArcGIS.Client Editor on an ArcGISLocalFeatureLayer where the edit changes are saved automatically. Individual Editor functions like: Add, Select, ClearSelection, EditVerticies, etc. are bound to Buttons using the Command property. Additional Editor functions like: Freehand, AutoComplete, AutoSelect, and ContinuousMode are bound to CheckBoxes using the IsChecked property.

To use the sample, use the Add Polygon button to draw a polygon feature on the map. Use other buttons to move or select and delete features. All changes are automatically committed to the database.

Download Sample Application
XAML C# VB.NET
<UserControl x:Class="ArcGISWPFSDK.LocalEditToolsAutoSave" x:Name="MyControl"
     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"
     xmlns:sys="clr-namespace:System;assembly=mscorlib">
    <Grid x:Name="LayoutRoot">
        <Grid.Resources>
            <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
            <esri:Editor x:Key="MyEditor"                         
                         LayerIDs="States"/>
            <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"/>
                <GradientStop Color="#FF3D7FAC" Offset="0.184"/>
                <GradientStop Color="#FF88C5EF" Offset="0.984"/>
            </LinearGradientBrush>
        </Grid.Resources>

        <esri:Map x:Name="MyMap" Extent="-15000000,2000000,-7000000,8000000" Background="#FFE3E3E3" WrapAround="True" esri:Editor.SnapDistance="20" esri:Editor.SnapKey="S" MinimumResolution="2445.98490512499">
            <esri:ArcGISLocalTiledLayer ID="BaseMap" Path="..\\Data\\TPKs\\Topographic.tpk"/>
            <esri:ArcGISLocalFeatureLayer ID="States" LayerName="States" 
                   Path="..\\Data\\MPKS\\USCitiesStatesEdit.mpk"  DisableClientCaching="True"  Editable="True"
                                    ValidateEdits="True" Mode="OnDemand"  SelectionColor="#FFFFFF00" AutoSave="True"                      
                    OutFields="STATE_NAME,POP2000"/>
        </esri:Map>

        <Border Background="{StaticResource PanelGradient}" BorderThickness="1" CornerRadius="5"
                HorizontalAlignment="Right"  VerticalAlignment="Top"
                Padding="5" BorderBrush="Black" Margin="0,5,5,0"
                DataContext="{StaticResource MyEditor}">

            <StackPanel x:Name="EditorTools" 
                        Orientation="Vertical">
                <StackPanel Orientation="Horizontal">
                    <Button x:Name="AddButton" Margin="2"
                         ToolTipService.ToolTip="Civil Disturbance"
                         Content="Add Polygon" IsEnabled="False" Click="AddButton_Click"></Button>
                    <Button x:Name="SelectButton" Margin="2"                            
                            Command="{Binding Select}" 
                            CommandParameter="New" >
                        <TextBlock>New<LineBreak/>Selection</TextBlock>
                    </Button>
                    <Button x:Name="AddSelectButton" Margin="2"                            
                            Command="{Binding Select}" 
                            CommandParameter="Add">
                        <TextBlock>Add to<LineBreak/>Selection</TextBlock>
                    </Button>
                    <Button x:Name="RemoveSelectButton" Margin="2"                             
                            Command="{Binding Select}"
                            CommandParameter="Remove" >
                        <TextBlock>Remove from<LineBreak/>Selection</TextBlock>
                    </Button>
                    <Button x:Name="ClearSelectionButton" Margin="2"                            
                            Command="{Binding ClearSelection}">
                        <TextBlock>Clear<LineBreak/>Selection</TextBlock>
                    </Button>
                    <Button x:Name="DeleteButton" Margin="2"                           
                            Command="{Binding DeleteSelected}">
                        <TextBlock>Delete<LineBreak/>Selected</TextBlock>
                    </Button>
                    <Button x:Name="CancelButton" Margin="2"                           
                            Command="{Binding CancelActive}">
                        <TextBlock>Cancel<LineBreak/>Action</TextBlock>
                    </Button>
                </StackPanel>
                <StackPanel Orientation="Horizontal">
                    <CheckBox x:Name="FreehandCheckBox" VerticalAlignment="Center" Margin="2" Foreground="white" FontFamily="Verdana"
                          IsChecked="{Binding Path=Freehand, Mode=TwoWay}" 
                          Content="Freehand Draw" />
                    <CheckBox x:Name="AutoCompleteCheckBox" VerticalAlignment="Center" Margin="2" Foreground="white" FontFamily="Verdana"
                          IsChecked="{Binding Path=AutoComplete, Mode=TwoWay}" 
                          Content="Auto Complete" />
                    <CheckBox x:Name="AutoSelectCheckBox" VerticalAlignment="Center" Margin="2" Foreground="white" FontFamily="Verdana"
                          IsChecked="{Binding Path=AutoSelect, Mode=TwoWay}" 
                          Content="Auto Select" />
                    <CheckBox x:Name="ContinuousCheckBox" VerticalAlignment="Center" Margin="2" Foreground="white" FontFamily="Verdana"
                          IsChecked="{Binding Path=ContinuousMode, Mode=TwoWay}" 
                          Content="Continuous Action" />
                </StackPanel>
            </StackPanel>

        </Border>

        <Grid HorizontalAlignment="Left" VerticalAlignment="Top" Margin="10,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" Text="Use the Add Polygon button to enable drawing a polygon feature on the map.  Use other buttons to move or select and delete features.  All changes are automatically commited to the database." 
                       Width="200" TextAlignment="Left" Margin="30,20,20,30" TextWrapping="Wrap"  Foreground="Black" />
        </Grid>
        <ProgressBar x:Name="MyProgressBar" IsIndeterminate="True" VerticalAlignment="Bottom" Width="200" Height="20" Margin="10" Visibility="{Binding Path=IsBusy, Converter={StaticResource BooleanToVisibilityConverter}}"></ProgressBar>
    </Grid>
</UserControl>
Sample code usage restrictions
5/16/2014