Navigate to previous and Next Tools do not work.

3115
6
09-29-2010 10:35 AM
ShaningYu
Frequent Contributor
I loaded the sample code from http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#ToolBarWidget, which contains the navigation tools.  However, both the To Previous and To Next tools do not function. 
For the code in the XAML file,
<esri:ToolbarItem.Content>
                                    <Image Source="/Assets/images/i_next.png" IsHitTestVisible="False" ...
I removed   IsHitTestVisible="False"
But it still does not function well.  I debugged its C# code for Previous Extent, and observed that _currentExtentIndex is always 0.  Then,
                        if (_currentExtentIndex == !0)    {
                           ......
                        }
                        break;
it goes to break. 
I got similiar result for the Next Extent.
If you know where the problem is, please share your experience.  Thanks.
0 Kudos
6 Replies
JenniferNery
Esri Regular Contributor
The Previous and Next Extents are not enabled until you actually change your map extent by panning/zooming.  If you use the live sample, you can check that as soon as you pan/zoom, Previous extent becomes enabled and you can navigate between the previous and next extents. So, they both function, it is just that they are both initially disabled since there are no extents to navigate to just yet.
0 Kudos
ShaningYu
Frequent Contributor
Jennifer:  Thanks for your response.  I tested.  The Navigate to Previous and Next tools still do not work.
0 Kudos
BrianPangtay
Occasional Contributor
You need to test the sample in the following manner:

1. Zoom in once. The Previous icon will now become enabled.
2. Zoom in again.
3. Click on Previous icon, the map will display as after step 1. The Next icon will become enabled.
4. Click on the Next icon, the map will display as after step 2.

The application is storing the map extent changes. When the app. is initially launched, there is nothing stored. Once one starts changing the map extent by zooming in and out, then the app. pushes those map extent changes into a stack. Previous starts at the top of the stack and goes down until it reaches the bottom. Next will start at the current location in the stack and go up until it reaches the top of the stack.

Thus, Previous is disabled at the bottom. Next is disabled at the top. Both are disabled when the stack is empty.
0 Kudos
DavidFlack
New Contributor III
I had this problem too when I started with my own xaml file and later added the toolbar.  Be sure the map in the xaml file has the ExtentChanged event wired up to the "MyMap_ExtentChanged" handler. 

<esri:Map x:Name="MyMap" ExtentChanged="MyMap_ExtentChanged">
0 Kudos
NewingtonConnecticut
New Contributor II
Thanks- this info would have been helpful as a comment in the code or xaml...

Thad
0 Kudos
JenniferNery
Esri Regular Contributor
Thanks for your feedback. We'll see what we can do to avoid the confusion.
0 Kudos