Bonjour.
je vous présente mon code XAML et mon C#.
puis C#
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 <!--Overview Map--> <StackPanel Grid.Row="1" Margin="0,160,5,0" Width="215" Canvas.ZIndex="200" Background="DarkGreen" Orientation="Vertical" VerticalAlignment="Top" HorizontalAlignment="Right" Height="200"> <TextBlock Text="Overview Map" Foreground="White" FontSize="14" FontWeight="Bold" Margin="4" /> <esri:OverviewMap Name="overviewMap1" Height="165" Width="210" MaximumExtent="-17376276,-11584184.511,18941707,14401959" Map="{Binding ElementName=MyMap}"> <esri:ArcGISTiledMapServiceLayer ID="OVImageLayer" Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"/> </esri:OverviewMap> </StackPanel>
le code C# me permet de passer d'une URL a une autre. Avec le control Map c'est possible. Mais celui de Overview Map il me demande qu'un seul.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 private void RadioButton_Click(object sender, RoutedEventArgs e) { int index = Convert.ToInt32(((RadioButton)sender).Tag); //ArcGISTiledMapServiceLayer baseMap = MyMap.Layers["BaseMap"] as ArcGISTiledMapServiceLayer; ArcGISTiledMapServiceLayer OvbaseMap = MyMap.Layers["OVImageLayer"] as ArcGISTiledMapServiceLayer; switch (index) { case 0: //baseMap.Url = "http://services.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer"; OvbaseMap.Url = "http://services.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer"; break; case 1: //baseMap.Url = "http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"; OvbaseMap.Url = "http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"; break; case 2: //baseMap.Url = "http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"; OvbaseMap.Url = "http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"; break; } }
Est ce possible de changer automatique de couche dans le Overview Map?
Partager