Select to view content in your preferred language

Silverlight 2.1 API legend control does not refresh with 10SP1 Services

3183
15
03-08-2011 12:22 PM
SloaneWalker
Emerging Contributor
I am using silverlight 2.1 API, Visual Studio 2010, ArcGIS 10.0 SP1 and my legend control will not refresh.  The Service can be turned on and off, but not the sub layers.  If I switch over to my 10 Services on my Production Server, it works. Has anyone else had this problem?
0 Kudos
15 Replies
SloaneWalker
Emerging Contributor
Your suggestion did not net any results, however it did give me some ideas to try.  If I remove the max and min scales, the legend works correctly.  This of course is not an acceptable solution.  Has something changed regarding scale dependancy in services between 10 and 10.01?

Also, sorry, the URL I gave you was not correct, here is the correct one:

http://buster.rdffg.bc.ca/ArcGIS/rest/services/theMAPex/theMAPexAddresses/MapServer

I appreciate your attention to this.
0 Kudos
DominiqueBroux
Esri Frequent Contributor
What is your exactly the issue.
Is it that you are not enable to change the status of the visibility checkbox (i.e it's still checked or unchecked but you can't change).

Or is it that you can change the status but you see the sublayer even if the checkbox is not checked?

Side note : your map service seems to have some reversed minscale and maxscale (layers 2 and 3) but I guess it's due to your tests since there was not this issue in the first version you sent.
0 Kudos
SloaneWalker
Emerging Contributor
This is my issue.

Is it that you are not enable to change the status of the visibility checkbox (i.e it's still checked or unchecked but you can't change).  Yes, that is what is happening.

When the layers load, the checkboxes indicate the current status, but they do not change when the map is zoomed or when the checkboxes are checked.

Thank you
0 Kudos
DominiqueBroux
Esri Frequent Contributor
The only explanation I can figure out is that the checkbox is not enabled as long as the layer is not visible at the scale.

It means that you are binding the IsEnabled property with something like:

 
<CheckBox Content="{Binding Label}"
                  IsChecked="{Binding IsEnabled, Mode=TwoWay}"
                  IsEnabled="{Binding IsInScaleRange}" >
                            </CheckBox>


but this should work by removing the binding to IsInScaleRange:

 
<CheckBox Content="{Binding Label}"
                  IsChecked="{Binding IsEnabled, Mode=TwoWay}"
                             </CheckBox>


Could you test again?

Note : you can also test by setting a low value for the MinimumResolution of your map, so you will be able to zoom in to a large scale and the checkboxes shoud become available.
0 Kudos
BrandonCales
Regular Contributor
The code below is what i am using, however it appears that the MinimumResolution is not being pulled from my map service...so the IsInScaleRange isn't working.


<esri:Legend.LayerTemplate>
                                <DataTemplate>
                                    <StackPanel Orientation="Horizontal">
                                        <ToolTipService.ToolTip>
                                            <StackPanel MaxWidth="400">
                                                <TextBlock FontWeight="Bold" Text="{Binding Layer.ID}" TextWrapping="Wrap" />
                                                <TextBlock FontWeight="Bold" Text="{Binding Label}" TextWrapping="Wrap" />
                                                <TextBlock Text="{Binding Description}" TextWrapping="Wrap" />
                                                <TextBlock Text="{Binding SubLayerID, StringFormat='SubLayer ID : {0}'}" />
                                                <TextBlock Text="{Binding MinimumResolution, StringFormat='Minimum Resolution : {0:F6}'}" />
                                                <TextBlock Text="{Binding MaximumResolution, StringFormat='Maximum Resolution : {0:F6}'}" />
                                            </StackPanel>
                                        </ToolTipService.ToolTip>
                                        
                                        <CheckBox IsChecked="{Binding IsEnabled, Mode=TwoWay}" IsEnabled="{Binding IsInScaleRange}" />
                                        <TextBlock Text=":::" VerticalAlignment="Center"/>
                                        <TextBlock Text="{Binding Label}" VerticalAlignment="Center"/>
                                    </StackPanel>
                                </DataTemplate>
                            </esri:Legend.LayerTemplate>
0 Kudos
BrandonCales
Regular Contributor
Fixed my issue once SP2 was installed - apparently this was resolved with SP1

The code below is what i am using, however it appears that the MinimumResolution is not being pulled from my map service...so the IsInScaleRange isn't working.


<esri:Legend.LayerTemplate>
                                <DataTemplate>
                                    <StackPanel Orientation="Horizontal">
                                        <ToolTipService.ToolTip>
                                            <StackPanel MaxWidth="400">
                                                <TextBlock FontWeight="Bold" Text="{Binding Layer.ID}" TextWrapping="Wrap" />
                                                <TextBlock FontWeight="Bold" Text="{Binding Label}" TextWrapping="Wrap" />
                                                <TextBlock Text="{Binding Description}" TextWrapping="Wrap" />
                                                <TextBlock Text="{Binding SubLayerID, StringFormat='SubLayer ID : {0}'}" />
                                                <TextBlock Text="{Binding MinimumResolution, StringFormat='Minimum Resolution : {0:F6}'}" />
                                                <TextBlock Text="{Binding MaximumResolution, StringFormat='Maximum Resolution : {0:F6}'}" />
                                            </StackPanel>
                                        </ToolTipService.ToolTip>
                                        
                                        <CheckBox IsChecked="{Binding IsEnabled, Mode=TwoWay}" IsEnabled="{Binding IsInScaleRange}" />
                                        <TextBlock Text=":::" VerticalAlignment="Center"/>
                                        <TextBlock Text="{Binding Label}" VerticalAlignment="Center"/>
                                    </StackPanel>
                                </DataTemplate>
                            </esri:Legend.LayerTemplate>
0 Kudos