Select to view content in your preferred language

Specify which FeatureLayer is selectable

1258
4
Jump to solution
01-09-2012 08:59 AM
JayKappy
Frequent Contributor
I have an app that has a series of radio buttins that allow the user to select which feature to edit.
On selection the Editor LayerIDs are set to this specific layer
But what I want to do on top of that is to make only those features selectable....

Any ideas on how to set the selectable layer to a specific Feature Layer? Any examples?  I assme that it would be easiest to set on the radio button change....

Maybe this is something I can do on the Radio Button change?
    Private Sub HandleCheck(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)         Dim rb As RadioButton = TryCast(sender, RadioButton)         EditLayer.Text = "You are now editing: " + ": " + rb.Name          Dim _checkedValue As String = rb.Name          If _checkedValue = "Point" Then             EditLayer2.Text = "MG_Point"             Dim MyEditor = TryCast(Me.LayoutRoot.Resources("MyEditor"), Editor)             MyEditor.LayerIDs = New String() {EditLayer2.Text}         ElseIf _checkedValue = "Line" Then             EditLayer2.Text = "MG_Line"             Dim MyEditor = TryCast(Me.LayoutRoot.Resources("MyEditor"), Editor)             MyEditor.LayerIDs = New String() {EditLayer2.Text}         ElseIf _checkedValue = "Polygon" Then             EditLayer2.Text = "MG_Polygon"             Dim MyEditor = TryCast(Me.LayoutRoot.Resources("MyEditor"), Editor)             MyEditor.LayerIDs = New String() {EditLayer2.Text}         Else          End If     End Sub
0 Kudos
1 Solution

Accepted Solutions
DominiqueBroux
Esri Frequent Contributor
BUT REGARDLESS of which radion button is selected (which is controling my edit target) I can select points, lines, polygons from 3 differrent feature layers..


Your issue is perhaps coming from the binding with your radio button.
Could you test with a predefined LayerID? In this case can you still select the 3 different feature layers?

View solution in original post

0 Kudos
4 Replies
JenniferNery
Esri Regular Contributor
Sure, your code seems correct. This Editor.LayerIDs property will be applied the next time Editor.Select command becomes active.
0 Kudos
JayKappy
Frequent Contributor
THanks for your reply Jennifer
I am confused....I know the LAyersID are being set..
I have this in the XAML

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

I have the code above in VB

BUT REGARDLESS of which radion button is selected (which is controling my edit target) I can select points, lines, polygons from 3 differrent feature layers..
I dont see anywhere where I am setting the selectable layer as I am setting the "LayerID"

I guess its not to big of a deal...but was just curious if I could limit the selection to only the active edit target (the LayerID identified)

Thoughts?
0 Kudos
DominiqueBroux
Esri Frequent Contributor
BUT REGARDLESS of which radion button is selected (which is controling my edit target) I can select points, lines, polygons from 3 differrent feature layers..


Your issue is perhaps coming from the binding with your radio button.
Could you test with a predefined LayerID? In this case can you still select the 3 different feature layers?
0 Kudos
JayKappy
Frequent Contributor
Thanks again for yoru reply....I think i found it....I am using a mash of code from the edit examples online ArcGIS API for Silverlight...
It turns out that I have a MouseLeftButtnUp Event firing when selecting features....and this is the way I set out to do it...I decided that I want the user to be able to select and update any feature regardless of the edit LayersID setting.

Right now the user can select and upate any feature
The user although, cannot ADD any feature....they have to use the radio buttons (future combobox) to set the edit layer in order to add a feature.

I think everything is the way I want it now....

http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#ToolkitEditorWidget
http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#ToolkitFeatureDataForm
http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#EditToolsAutoSave

I DO thank you very much for your time and efforts to help...they are very apprecaited.

On MouseLeftButtonUp I am selecting the feature, unselecting other features, and opening the dataform to edit data...

    Private Sub Points_MouseLeftButtonUp(ByVal sender As Object, ByVal args As GraphicMouseButtonEventArgs)

        Dim featureLayer As FeatureLayer = TryCast(sender, FeatureLayer)

        For Each g As Graphic In featureLayer.Graphics
            If (g.Selected) Then
                g.UnSelect()
            End If
        Next

        args.Graphic.Select()
        MyPointFeatureDataForm.GraphicSource = args.Graphic

        ' ON POLYGON SELECT, UNSELECT THE LINES
        Dim l_line As FeatureLayer = TryCast(Me.MyMap.Layers("MG_Line"), FeatureLayer)
        For Each g As Graphic In l_line.Graphics
            If (g.Selected) Then
                g.UnSelect()
            End If
        Next

        ' ON POLYGON SELECT, UNSELECT THE PLYGONS
        Dim l_polygon As FeatureLayer = TryCast(Me.MyMap.Layers("MG_Polygon"), FeatureLayer)
        For Each g As Graphic In l_polygon.Graphics
            If (g.Selected) Then
                g.UnSelect()
            End If
        Next

            PointDataFormBorder.Visibility = Visibility.Visible
            CloseButtonPoint.Visibility = Visibility.Visible

            PointDataFormBorder.Visibility = Visibility.Visible
            LineDataFormBorder.Visibility = Visibility.Collapsed
            PolygonDataFormBorder.Visibility = Visibility.Collapsed
    End Sub
0 Kudos