<Button Command="{Binding Add}" Content="Add Polygon" Margin="2" ToolTipService.ToolTip="Civil Disturbance"> <Button.CommandParameter> <sys:Int32>10101</sys:Int32> </Button.CommandParameter> </Button>
private void CancelEditsButton_Click(object sender, RoutedEventArgs e) { Editor editor = LayoutRoot.Resources["MyEditor"] as Editor; foreach (GraphicsLayer graphicsLayer in editor.GraphicsLayers) { if (graphicsLayer is FeatureLayer) { FeatureLayer featureLayer = graphicsLayer as FeatureLayer; if (featureLayer.HasEdits) featureLayer.Update(); } } }
<Grid.Resources> <esri:Editor x:Key="MyEditor" Map="{Binding ElementName=MyMap}" LayerIDs="ThreatAreas" GeometryServiceUrl="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer" /> </Grid.Resources>
<esri:FeatureLayer ID="ThreatAreas" Url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/HomelandSecurity/operations/FeatureServer/2" AutoSave="False" Mode="OnDemand" ValidateEdits="True" DisableClientCaching="True" />
<Border Background="#FF919191" 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="Fire" Content="Add Polygon" Command="{Binding Add}"> <Button.CommandParameter> <sys:Int32>10301</sys:Int32> </Button.CommandParameter> </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"> <Button x:Name="EditVerticesButton" Margin="2" Command="{Binding EditVertices}"> <TextBlock>Edit Vertices<LineBreak/>/Move Selected</TextBlock> </Button> <Button x:Name="CutButton" Margin="2" Command="{Binding Cut}"> <TextBlock>Cut<LineBreak/>Selected</TextBlock> </Button> <Button x:Name="ReshapeButton" Margin="2" Command="{Binding Reshape}"> <TextBlock>Reshape<LineBreak/>Selected</TextBlock> </Button> <Button x:Name="UnionButton" Margin="2" Command="{Binding Union}"> <TextBlock>Union<LineBreak/>Selected</TextBlock> </Button> <Button x:Name="SaveButton" Margin="2" Command="{Binding Save}"> <TextBlock FontWeight="Bold">Save<LineBreak/>Edits</TextBlock> </Button> <Button x:Name="CancelEditsButton" Margin="2" IsEnabled="{Binding ElementName=MyMap, Path=Layers[ThreatAreas].HasEdits}" Click="CancelEditsButton_Click" > <TextBlock FontWeight="Bold">Cancel<LineBreak/>Edits</TextBlock> </Button> </StackPanel> <StackPanel Orientation="Horizontal"> <CheckBox x:Name="FreehandCheckBox" VerticalAlignment="Center" Margin="2" IsChecked="{Binding Path=Freehand, Mode=TwoWay}" Content="Freehand Draw" /> <CheckBox x:Name="AutoCompleteCheckBox" VerticalAlignment="Center" Margin="2" IsChecked="{Binding Path=AutoComplete, Mode=TwoWay}" Content="Auto Complete" /> <CheckBox x:Name="AutoSelectCheckBox" VerticalAlignment="Center" Margin="2" IsChecked="{Binding Path=AutoSelect, Mode=TwoWay}" Content="Auto Select" /> <CheckBox x:Name="ContinuousCheckBox" VerticalAlignment="Center" Margin="2" IsChecked="{Binding Path=ContinuousMode, Mode=TwoWay}" Content="Continuous Action" /> </StackPanel> </StackPanel> </Border>
Most of the work is done by the Editor control which is provided by the SL API.
but still everything what I am seeing after clicking "code behind C#" is just a few lines. Could you, please tell me where I can find the rest of the code?
This is where you download the full SDK: http://help.arcgis.com/en/webapi/silverlight/help/index.html#/Sample_Interactive_SDK/01660000000v000000/When Navigating our SDK Interactive Sample page http://esriurl.com/slsdk2:You need to select from the side menu items: Editing > Edit Tools - Explicit SaveTo get to : http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#EditToolsExplicitSaveThere are tab menu items you can select from (Live Sample, XAML, Code Behind C#, Code Behind VB) by default it is Live Sample.
Membros conectados podem postar, seguir atualizações e mais. Novo aqui? Registre uma conta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.