I am trying to add point feature for a featurelayer (point geometry) using the EDITOR in the SL API. This is what I do, see code. I want a sample how this can be done.
<Button x:Name="btnAdd" Width="30" Height="30" Margin="120,-125,0,0" ToolTipService.ToolTip="Install a Sign"
cal:Click.Command="{Binding EditorAddCommand}"
cal:Click.CommandParameter=""
Visibility="{Binding EditButtonsVisibility}"
>
<Button.Content>
<Image x:Name="imgMin4"
Source="/CoM.EGIS.Infrastructure;Component/Assets/Images/DrawPoint.png"
Stretch="Fill" HorizontalAlignment="Center" />
</Button.Content>
</Button>
#region Editor
private void OnEditorAddCommand(string value)
{
EditorAddCommand = SignsEditor.Add;
}
private void Editing()
{
string[] layerids = new string[] { Map.Layers["TrafficSigns"].ToString(),"" };
SignsEditor.Map = this.Map;
SignsEditor.LayerIDs = layerids;
SignsEditor.GeometryServiceUrl = "http://memgisdev4.memphis.ad/ArcGIS/rest/services/Geometry/GeometryServer";
SignsEditor.EditorActivated += new EventHandler<Editor.CommandEventArgs>(SignsEditor_EditorActivated);
SignsEditor.EditCompleted += (SignsEditor_EditCompleted);
}
private void SignsEditor_EditCompleted(object sender, Editor.EditEventArgs e)
{
// show the data on the form
foreach (Editor.Change change in e.Edits)
{
if (change.Layer != null && change.Layer is FeatureLayer && change.Graphic != null)
{
FeatureLayer featureLayer = change.Layer as FeatureLayer;
//set the form values with a new PUKID which
}
}
}
public string LayerID { get; set; }
private void SignsEditor_EditorActivated(object sender, Editor.CommandEventArgs args)
{
OnEditorActivated(args);
}
/// <summary>
/// Occurs when an editor has been activated.
/// </summary>
public event EventHandler<Editor.CommandEventArgs> EditorActivated;
private void OnEditorActivated(Editor.CommandEventArgs args)
{
EventHandler<Editor.CommandEventArgs> handler = EditorActivated;
if (handler != null)
handler(this, args);
}
private void OnEditCompleted(Editor.EditEventArgs args)
{
}