Select to view content in your preferred language

ToggleLayerAction

928
6
05-27-2011 01:00 PM
DaveOrlando
Frequent Contributor
okay I must officially be going crazy,

I found this wonderful little action and low and behold, my layer only toggles on/off
1. after you pan the map, and/or
2. evertime after the first (no need to pan)

anyone else have a similar issue?

<Button x:Name="MTWater"
                                    Style="{StaticResource MenuItem}"
                                    Content="Map Tip Water">
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <esriBehaviors:ToggleLayerAction LayerID="FLWaterLines" TargetName="MyMap"/>
                                    </i:EventTrigger>
                                    <!--<i:EventTrigger>
                                        <esriBehaviors:UpdateFeatureLayerAction FeatureLayerID="FLWaterLines" TargetName="MyMap"/>
                                    </i:EventTrigger>-->
                                </i:Interaction.Triggers>
                            </Button>


#plsworkthefirsttimeforonce
0 Kudos
6 Replies
DaveOrlando
Frequent Contributor
further,

if I start with the Layer Visible = true, it turns off okay at first attempt.
if I start with the Layer Visible = false, it won't turn on at first attempt until the map is panned.
0 Kudos
DominiqueBroux
Esri Frequent Contributor
I didn't reproduce the issue.

I changed this interactive sample http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#LayerActions in order to start with a non visible layer and the layer turns on at first attempt when clicking the ToggleLayer action.

Could you give more infos on how to reproduce this issue?

Thanks
0 Kudos
DaveOrlando
Frequent Contributor
Thanks for checking,

Can you verify with a FeatrureLayer using OnDemand and a MaxResolution set (yes I was below this resolution when I first tryed to turn it on).

<esri:FeatureLayer ID="FLWaterLines" Url="http://***/rest/services/GIS_App_ENG/MapServer/2"
                                       FeatureSymbol="{StaticResource LineWaterBlue}" Mode="OnDemand" OutFields="*" MaximumResolution="3"
                                       Visible="False" x:Name="FLWL" Where="WATERLINETYPE='WATERMAIN'">


<Button x:Name="MTWater"
                                    Style="{StaticResource MenuItem}"
                                    Content="Map Tip Water">
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <esriBehaviors:ToggleLayerAction LayerID="FLWaterLines" TargetName="MyMap"/>
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>


Thanks again
0 Kudos
DominiqueBroux
Esri Frequent Contributor
I was eventually  able to reproduce the issue with a feature layer but only with 2.1 version. Looks working well with version 2.2.

Which version are you using? If 2.1, could you give a try with 2.2?

Thanks
0 Kudos
DaveOrlando
Frequent Contributor
Thanks for your efforts.

I am meaning to go to 2.2 soon, hopefully this week, so I will repost my findings.

Dave
0 Kudos
DaveOrlando
Frequent Contributor
2.2 has cleared this up for us, 😉 great work.

Thanks again.
0 Kudos