Problem with editorwidget

1639
1
05-21-2012 04:05 AM
by Anonymous User
Not applicable
Original User: moelgaard

Hi everyone.

I´m trying to get the EditorWidget (http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#ToolkitEditorWidget) to work in my silverlight program.
The editortoolbar is displayed but the grid with the aviable features are not displayed and I´m wondering which part of the code actuallt creates this. Allso the "delete selected feature" is missing from my toolbar (attached is two images. One captured befores (silverlight_editor_toolbar.jpg) the featurelayer is loaded displaying all the available tools, and one (silverlight_editor_toolbar_loaded.png) displaying the actual tools available, once the featurelayer is loaded).

The loading of layers (done in code-behind) are done like this:

                ArcGISDynamicMapServiceLayer aflob = new ArcGISDynamicMapServiceLayer();
                aflob.Url = _mainPageViewModel.SetupModel.LayersUrl;
                aflob.ID = "sl";
                Map.Layers.Add(aflob);

                FeatureLayer fLayer = new FeatureLayer();
                fLayer.Url = GetSearchLayer();
                fLayer.ID = "PointLayer";
                fLayer.AutoSave = false;
                fLayer.DisableClientCaching = true;
                fLayer.Mode = FeatureLayer.QueryMode.OnDemand;
               
                ESRI.ArcGIS.Client.Tasks.OutFields outFields = new OutFields();
                outFields.Add("*");
                fLayer.OutFields = outFields;

                Map.Layers.Add(fLayer);

The XAML part looks like this:
<StackPanel  x:Name="EditorToolStrip" Margin="0,5,5,0" >
                <Border Background="#00919191" CornerRadius="5"
               HorizontalAlignment="Right"  VerticalAlignment="Top"
               Padding="5" BorderBrush="Transparent">
                    <Border.Effect>
                        <DropShadowEffect Color="Black" Direction="-45" BlurRadius="20" Opacity=".75" />
                    </Border.Effect>
                    <StackPanel Orientation="Vertical" HorizontalAlignment="Left" Margin="10,20,5,0" VerticalAlignment="Bottom" >
                        <esri:EditorWidget x:Name="MyEditorWidget"
                             Map="{Binding ElementName=Map}"
                                      Width="300"
                                      AutoSelect="False"
                                      AlwaysDisplayDefaultTemplates="True"
                                      GeometryServiceUrl="http://localhost/ArcGIS/rest/services/Geometry/GeometryServer"
                                      ShowAttributesOnAdd="True" 
                                      Loaded="EditorWidget_Loaded"/>
                    </StackPanel>
                </Border>
            </StackPanel>

And the correspondent "EditorWidget_Loaded" looks like this:

        private void EditorWidget_Loaded(object sender, RoutedEventArgs e)
        {
            string[] myLayerIDs = { "PointLayer" };
            MyEditorWidget.LayerIDs = myLayerIDs;
        }

Any suggestions/comments are greatly appreciated
/Kaare
0 Kudos
1 Reply
by Anonymous User
Not applicable
Original User: moelgaard

Found the mistake myself. When adding the featurelayer in code-behind I was using http://...../mapserver/ instead of http://..../FeatureServer/

/Kaare
0 Kudos