Select to view content in your preferred language

Editor Wigit

807
7
01-04-2012 10:34 AM
JayKappy
Occasional Contributor
I am referncing this example for editing:
http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#EditToolsExplicitSave

Everything is working fine but as the example shows its tageting a single editable Feature Classes.  I have 3 editable FC's....

I assume that I can add a combox with the 3 FCs names?
Forcing the user to choose one...
The set the LayerIDs in the XAML file to that value?

For starters I created a textblock and hardcoded the layerIDs name
I then set the Editor as such

Everything seems to work except now the Add Polygon as seen in the example is grayed out....any thoughts?

Why is the Add Polygon now disabled and not selectable?

I basically want to be able to switch the editable FC....and Bind that to the LayerIDs in the Editor

<TextBlock x:Name="EditLayer" Text="MG_Polygon" FontSize="15" HorizontalAlignment="Center" FontStyle="Italic" Foreground="#FF0D2764" Margin="0,10,0,0"  />
                                   
<esri:Editor x:Key="MyEditorPoint"
     Map="{Binding ElementName=MyMap}" 
     LayerIDs="{Binding ElementName=EditLayer, Path=Text}"
                         GeometryServiceUrl="http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer" />

                                    <Border Background="#FF919191" BorderThickness="1" CornerRadius="5"
                                     HorizontalAlignment="Right"  VerticalAlignment="Top"
                                     Padding="5" BorderBrush="Black" Margin="0,5,5,0"
                                        DataContext="{StaticResource MyEditorPoint}">                                        
                                        <StackPanel x:Name="EditorTools" Orientation="Vertical">
                                            <StackPanel Orientation="Horizontal">
                                                <Button Command="{Binding Add}" Margin="2"
                                                    ToolTipService.ToolTip="Fire"
                                                    Content="Add Polygon">
                                                    <Button.CommandParameter>
                                                        <sys:Int32>10301</sys:Int32>
                                                    </Button.CommandParameter>
                                                </Button>                                                
                                                 <Button Command="{Binding DeleteSelected}" Margin="2">
                                                    <TextBlock>Delete<LineBreak/>Selected</TextBlock>
                                                </Button>
                                                <Button Command="{Binding ClearSelection}" Margin="2">
                                                    <TextBlock>Clear<LineBreak/>Selection</TextBlock>
                                                </Button>
                                                <Button Command="{Binding EditVertices}" Margin="2">
                                                    <TextBlock>Edit Vertices<LineBreak/>/Move Selected</TextBlock>
                                                </Button>
                                            </StackPanel>
                                        </StackPanel>
                                    </Border>
0 Kudos
7 Replies
JayKappy
Occasional Contributor
..............................................removed
0 Kudos
JayKappy
Occasional Contributor
Let me rephrase that....I can change the LayerIDs from a point to a line to a Polygon feature and it works fine....
But I can only define one feature type at a time for Adding Features

So as seen in my first post I am trying to BIND a value from textblock or combobox into the LayerIDs for the editor below...

CAN I DO THIS?  why is it not working the way I have it set up in my FIRST POST?

How else would I change the editing (LayerIDs) to target a specific layer to edit?
0 Kudos
KeithAnderson
New Contributor III
If the "Add Polygon" button is greyed out, the FeatureLayer URL may be incorrect.
0 Kudos
JenniferNery
Esri Regular Contributor
Add.CommandParameter is specific to the service you are using as mentioned in this forum post: http://forums.arcgis.com/threads/19100-Silverlight-samples-from-ESRI.
0 Kudos
JayKappy
Occasional Contributor
Hello Jennifer..was wondering if I could set the LayerIDs in the <esri:Editor> manually.....say I have a drop down or in the case below a simple textblock hardcoded to a value...
Could I update the LayerIDs

I tried the code below in VB and am gettng errors....

XAML
            
                <esri:Editor x:Key="MyEditor"
                Map="{Binding ElementName=MyMap}" 
                LayerIDs="MG_Point"
                GeometryServiceUrl="http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"  />


               <TextBlock x:Name="EditLayer" Text="MG_Polygon" FontSize="15" HorizontalAlignment="Center" 
                    FontStyle="Italic" Foreground="#FF0D2764" Margin="0,10,0,0"  />

VB
            
               OnLayerChange() ' OR SOMETHING SIMILAR
               Editor = TryCast(Resources.element("MyEditorPoint"), Editor)
               Editor.LayerIDs = EditLayer.Text



I then tried this and get another error

              Dim MyEditor = TryCast(Resources.Element("MyEditor"), Editor)
            MyEditor.LayerIDs = EditLayer.Text


Error: Element is not a not a memeber of System.Windos.ResourcesDictionary
0 Kudos
JenniferNery
Esri Regular Contributor
The error message seems to come from the first line. I believe you can replace with the following code if you define your editor inside LayoutRoot.Resources. Also LayerIDs is an array.
Dim MyEditor= TryCast(Me.LayoutRoot.Resources("MyEditorPoint"), Editor)
MyEditor.LayerIDs = New String() {EditLayer.Text}
0 Kudos
JayKappy
Occasional Contributor
Thank you much Jennifer....once again saved the day....
Much Apprecaited...
0 Kudos