Select to view content in your preferred language

Adding layers to editor widget on the fly, missing symbols for single (first) layer

828
2
11-18-2010 05:20 AM
DanielWalton
Frequent Contributor
I am using the editor widget to edit feature services that the user can add at run time. Each time a user adds or subtracts a feature layer from the map, I am setting the EditorWidget.LayerIDs property accordingly. Oddly, there seems to be a bug in the TemplatePicker portion of the widget where when the control switches from 0 to 1 layers, the symbols are missing from the template. When you add a second layer, symbols from both layers show up. Adding more layers the control exhibits expected behavior, as well as when you remove layers. If this is fixed in 2.1, I can wait until release for it.
0 Kudos
2 Replies
JenniferNery
Esri Regular Contributor
Thank you for reporting this. We will try to get it fixed in future releases.
0 Kudos
JenniferNery
Esri Regular Contributor
For the time-being, you can do the following as workaround:

Ensure that the layer you are adding to the map is already initialized.
  private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
  {
   FeatureLayer l = new FeatureLayer() { ID = "Point", Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/HomelandSecurity/operations/FeatureServer/0" };
   l.Initialized += l_Initialized;
   l.Initialize();  
  }

  private void l_Initialized(object sender, System.EventArgs e)
  {
   this.MyMap.Layers.Add(sender as Layer);
   //this.MyEditorWidget.LayerIDs = new string[] { (sender as Layer).ID };
  }


Also, note that setting LayerIDs is optional. It is not necessary when you already bind the EditorWidget or TemplatePicker's Map property to your map and there are no editable FeatureLayers you are trying to exclude.

This should be sufficient (include GeometryService for Cut/Reshape/Union/Add with AutoComplete):
<esri:EditorWidget x:Name="MyEditorWidget" Map="{Binding ElementName=MyMap}" />
0 Kudos