Select to view content in your preferred language

Minimal Map Template Full Extent

2762
12
08-24-2011 04:08 PM
ChristineZeller
Occasional Contributor
I'm trying to change the Full Extent for the Minimal Template off the Interactive SDK.  I believe the xaml in the DarkStyle.xaml and/or BlueStyle.xaml is setting the properties of the button/icon (Height, ToolTip, etc) but I can't find the code to change the fullextent.

 <Button x:Name="ZoomFullExtent" Height="20" FontSize="8" Width="20" ToolTipService.ToolTip="Full Extent" Margin="2,0,2,5" Style="{StaticResource ClearButtonStyle}" Foreground="White" Padding="-5" Cursor="Hand" >
                                                            <Button.Content>

                                                                <Grid x:Name="ZoomFullExtentGrid" Height="20" Width="20" ToolTipService.ToolTip="Full Extent" Margin="-1,0,2,5" >
                                                                    <icons:WorldGlobe Scale="0.75" ExpandOnMouseOver="True" Cursor="Hand" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="-5" OceanFill="{StaticResource oceanBrush}" LandFill="{StaticResource landBrush}" />
                                                                </Grid>

                                                            </Button.Content>
                                                        </Button>



I think it is just taking the extent of all my services or the first service layer but I would like to do something like to set it to a single layer or something like this

 <i:Interaction.Triggers>
                                                    <i:EventTrigger EventName="Click">
                                                        <esri:ZoomToAction TargetName="Map">
                                                            <esri:ZoomToAction.Geometry>

                                                                <esri:Envelope XMin="-122.9" YMin="40.9" XMax="-117.9" YMax="30.1" />


                                                            </esri:ZoomToAction.Geometry>
                                                        </esri:ZoomToAction>
                                                    </i:EventTrigger>
                                                </i:Interaction.Triggers>



But this doesn't work or I don't know where to add it or where to find the code when the icon/button is click.  Can you help me?

Thanks
0 Kudos
12 Replies
JenniferNery
Esri Regular Contributor
Are you talking about the StartExtent that is used to set Map.Extent property?
Extent="{StaticResource StartExtent}"

If yes, in both the BlueStyle.xaml and DarkStyle.xaml, ResourceDictionary include
<esri:Envelope x:Key="StartExtent" XMin="-140" YMin="25" XMax="-90" YMax="60" />
0 Kudos
ChristineZeller
Occasional Contributor
Jennifer,
Thanks for the reply!
I have change the start extent in the darkstyle template.

I am basically just concerned with the full extent button (see the code I posted before and see the attachment for a screen shot) maybe this is just calling the StartExtent  but I'm not understanding how and it is not really respecting my new start extent (in the darkstyle).  Where is it calling or setting that when the full extent icon is clicked?
0 Kudos
ChristineZeller
Occasional Contributor
It seems like it is using the action ZoomToFullExtentAction but I can't seem to find where this action/behavior is set.  I've searched high and low and can't seem to find the tigger.
0 Kudos
JenniferNery
Esri Regular Contributor
I'm really not sure, I didn't write the template but you can search for keywords "zoom" or "extent" or "navigate." I think a good place to check is in Toolkit\Navigator\Navigator.cs and XAML files in Mimimal\styles folder so you can see which button is activated that results to the zoom to full extent.
0 Kudos
ChristineZeller
Occasional Contributor
Jennifer,

Thanks again for the reply.  I've check the xaml style files over and over.  I will look at the navigation.cs file.

As a work around is there a way I can just create a button click event and then somehow bind that click event to the MainPage.cs file so I can write the click event in the MainPage.CS file or do something like this

This doesn't work and give me an error that states zoomtoaction can not have a target property of type.

 <Button x:Name="ZoomFullExtent" Height="20" FontSize="8" Width="20" ToolTipService.ToolTip="Full Extent" Margin="2,0,2,5" Style="{StaticResource ClearButtonStyle}" Foreground="White" Padding="-5" Cursor="Hand">

                                                            <i:Interaction.Triggers>
                                                                <i:EventTrigger EventName="Click">
                                                                    <esri:ZoomToAction TargetName="{Binding ElementName=Minimal.MainPage.Map}">
                                                                        <esri:ZoomToAction.Geometry>

                                                                            <esri:Envelope 
                                                                 XMax="-113.071260498" 
                                                                 XMin="-125.47464635"
                                                                 YMax="42.48326291"
                                                                 YMin="32.060457634" />

                                                                        </esri:ZoomToAction.Geometry>
                                                                    </esri:ZoomToAction>
                                                                </i:EventTrigger>
                                                            </i:Interaction.Triggers>

                                                            <Button.Content>

                                                                <Grid x:Name="ZoomFullExtentGrid" Height="20" Width="20" ToolTipService.ToolTip="Full Extent" Margin="-1,0,2,5" >

                                                                    

                                                                    <icons:WorldGlobe Scale="0.75" ExpandOnMouseOver="True" Cursor="Hand" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="-5" OceanFill="{StaticResource oceanBrush}" LandFill="{StaticResource landBrush}" />
                                                                </Grid>

                                                            </Button.Content>
                                                        </Button>


I give the navigation and another run through and hopefully find something there.
0 Kudos
ChristineZeller
Occasional Contributor
Jennifer,

I gave Toolkit\Navigator\Navigator.cs, the WorldGlobe.cs, and XAML files in Mimimal\styles folder a good look.  I spent some serious time on it and couldn't find anything.  I searched for all the keywords you suggested and a few more. 

Seems so strange at this point I've been looking at this for two weeks now so I'm wondering if it is completely obvious and I'm just missing it.

There is reference to .ZoomTo(fullExtent) in the OverViewMap.cs file all of it seems to be relating to setting extent of OverviewMap. 

Any more suggestions?

Chris
0 Kudos
ChristineZeller
Occasional Contributor
Still working on this one and just seeing/hoping the right person will see it.

Christine
0 Kudos
DominiqueBroux
Esri Frequent Contributor
In Navigator.cs there is this code:
 
private void ZoomFullExtent_Click(object sender, RoutedEventArgs e)
{
  if (Map != null)
    Map.ZoomTo(Map.Layers.GetFullExtent());
}


You might replace this code by a zoomTo startExtent.
0 Kudos
ChristineZeller
Occasional Contributor
Dominique,

Thanks for the post but that code is not in the Navigation.cs file.  After you posted I searched the navigation.cs file for "ZoomFullExtent_Click" and couldn't find it; so then I search the entire solution again.  After that I thought I would download the Minimal Template again and start from scratch just to make sure I didn't delete anything and it is not there.  I guess I could add it but there is no defined click event in the blueStyle or darkStyle.xmal (see my very first post and you will see there is not a Click="ZoomFullExtent_Click" or any button.click - Click="") I could also add this but I'm not sure if I have to redirect it to Navigation.cs file since there is no BlueStyle or DarkStyle .cs file.

Thanks again,
Christine
0 Kudos