Navigation control map property

2771
4
05-15-2013 07:38 AM
Labels (1)
RonVincent
Occasional Contributor
I have a map and a navigation control in my app. Although the Navigation control's map property is set to the map, it doesn't work. I have to have one line of code to set in order for the Navigation control to buddy with the map:

navigation.map = map;

If I try with XAML it tells me that the map property is already set. Of course it actually is set in Properties in VS but it doesn't take.

Any ideas?

Thanks,

Ron
0 Kudos
4 Replies
MatthewBrown1
Occasional Contributor
Hi Ron,

Could you post your XAML/C#?

The navigation sample for the SDK has the following XAML:
<esri:Map x:Name="MyMap" Extent="-15000000,2000000,-7000000,8000000" WrapAround="True">
    <esri:ArcGISLocalTiledLayer ID="myBaseMap" Path="..\\Data\\TPKs\\Topographic.tpk"/>
</esri:Map>
<esri:Navigation Margin="5" HorizontalAlignment="Left" VerticalAlignment="Bottom"
                         Map="{Binding ElementName=MyMap}"  />



And no extra C# is required in the sample.
0 Kudos
RonVincent
Occasional Contributor
Hi Ron,

Could you post your XAML/C#?

The navigation sample for the SDK has the following XAML:
<esri:Map x:Name="MyMap" Extent="-15000000,2000000,-7000000,8000000" WrapAround="True">
    <esri:ArcGISLocalTiledLayer ID="myBaseMap" Path="..\\Data\\TPKs\\Topographic.tpk"/>
</esri:Map>
<esri:Navigation Margin="5" HorizontalAlignment="Left" VerticalAlignment="Bottom"
                         Map="{Binding ElementName=MyMap}"  />



And no extra C# is required in the sample.


Here is the XAML:

        <esri:Navigation  Height="140" 
                         Background="SteelBlue" 
                         HorizontalAlignment="Left" 
                         Margin="0,0,605,344" 
                         Name="navigation" 
                         VerticalAlignment="Top" 
                         Width="176" 
                         Foreground="SteelBlue" 
                         PanFactor="0.25" 
                         IsManipulationEnabled="False" 
                         Opacity="1"

                         >

            <esri:Navigation.Map>
                <esri:Map MinimumResolution="0.0000000000001"  IsLogoVisible="False" WrapAround="True" />
            </esri:Navigation.Map>
        </esri:Navigation>


After some more testing it appears that the problem is because the <esri:Navigation.Map> is being set. Once I remove those four lines of XAML it works as your example shows.
0 Kudos
MatthewBrown1
Occasional Contributor
Ron,

Can you check the project references and see if ESRI.ArcGIS.Client.Toolkit has been added? I have noticed that this is only added automatically if you drag and drop the Navigation control from the toolbox.
0 Kudos
AnttiKajanus1
Occasional Contributor III
Here is the XAML:

        <esri:Navigation  Height="140" 
                         Background="SteelBlue" 
                         HorizontalAlignment="Left" 
                         Margin="0,0,605,344" 
                         Name="navigation" 
                         VerticalAlignment="Top" 
                         Width="176" 
                         Foreground="SteelBlue" 
                         PanFactor="0.25" 
                         IsManipulationEnabled="False" 
                         Opacity="1"

                         >

            <esri:Navigation.Map>
                <esri:Map MinimumResolution="0.0000000000001"  IsLogoVisible="False" WrapAround="True" />
            </esri:Navigation.Map>
        </esri:Navigation>


After some more testing it appears that the problem is because the <esri:Navigation.Map> is being set. Once I remove those four lines of XAML it works as your example shows.


If i understood this correctly, you should create Map outside of the Navigation control and then reference to that with Map="{Binding ElementName=MyMap}". This way you don't create new Map for the navigation control but reference to existing one that is the correct.





0 Kudos