Skip to content

Commit bf5b0b8

Browse files
committed
Update FeatureLayerMapTips sample to use Naperville Shelters FeatureService.
1 parent 5b5164a commit bf5b0b8

File tree

5 files changed

+148
-142
lines changed

5 files changed

+148
-142
lines changed
Lines changed: 40 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,45 @@
11
<UserControl x:Class="ArcGISRuntimeSDKDotNet_DesktopSamples.Samples.FeatureLayerMapTips"
2-
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4-
xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013">
5-
<Grid>
6-
<esri:MapView x:Name="MyMapView" WrapAround="True"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013">
5+
<Grid>
6+
<esri:MapView x:Name="MyMapView" WrapAround="True"
77
MouseMove="MyMapView_MouseMove">
8-
<esri:Map>
9-
<esri:ArcGISTiledMapServiceLayer
10-
ServiceUri="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" />
8+
<esri:Map InitialViewpoint="-88.35,41.61,-88.05,41.84,4326">
119

12-
<esri:FeatureLayer x:Name="earthquakes" ID="featureLayer">
13-
<esri:FeatureLayer.Renderer>
14-
<esri:SimpleRenderer>
15-
<esri:SimpleMarkerSymbol Color="LightBlue" Style="Circle" Size="12">
16-
<esri:SimpleMarkerSymbol.Outline>
17-
<esri:SimpleLineSymbol Color="Blue" Width="2" Style="Solid" />
18-
</esri:SimpleMarkerSymbol.Outline>
19-
</esri:SimpleMarkerSymbol>
20-
</esri:SimpleRenderer>
21-
</esri:FeatureLayer.Renderer>
22-
<esri:FeatureLayer.FeatureTable>
23-
<esri:ServiceFeatureTable
24-
ServiceUri="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/EarthquakesFromLastSevenDays/FeatureServer/0"
25-
Where="magnitude >= 3.0" OutFields="*" />
26-
</esri:FeatureLayer.FeatureTable>
27-
</esri:FeatureLayer>
28-
</esri:Map>
10+
<esri:ArcGISTiledMapServiceLayer
11+
ServiceUri="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" />
2912

30-
<esri:MapView.Overlays>
31-
<esri:OverlayItemsControl>
32-
<Border x:Name="mapTip" Background="White" BorderBrush="Black" BorderThickness="2"
33-
Padding="4" Margin="4" HorizontalAlignment="Left" VerticalAlignment="Top"
34-
Visibility="Collapsed" esri:ViewBase.ViewOverlayAnchor="{Binding Geometry}">
35-
<StackPanel>
36-
<TextBlock Text="{Binding Attributes[datetime]}" FontWeight="Bold" />
37-
<TextBlock Text="{Binding Attributes[magnitude], StringFormat='Magnitude: {0}'}" />
38-
</StackPanel>
39-
</Border>
40-
</esri:OverlayItemsControl>
41-
</esri:MapView.Overlays>
42-
</esri:MapView>
43-
</Grid>
13+
<esri:FeatureLayer x:Name="shelters" ID="featureLayer">
14+
<esri:FeatureLayer.Renderer>
15+
<esri:SimpleRenderer>
16+
<esri:SimpleMarkerSymbol Color="LightBlue" Style="Circle" Size="12">
17+
<esri:SimpleMarkerSymbol.Outline>
18+
<esri:SimpleLineSymbol Color="Blue" Width="2" Style="Solid" />
19+
</esri:SimpleMarkerSymbol.Outline>
20+
</esri:SimpleMarkerSymbol>
21+
</esri:SimpleRenderer>
22+
</esri:FeatureLayer.Renderer>
23+
<esri:FeatureLayer.FeatureTable>
24+
<esri:ServiceFeatureTable
25+
ServiceUri="http://sampleserver6.arcgisonline.com/arcgis/rest/services/NapervilleShelters/FeatureServer/0"
26+
OutFields="*" />
27+
</esri:FeatureLayer.FeatureTable>
28+
</esri:FeatureLayer>
29+
</esri:Map>
30+
31+
<esri:MapView.Overlays>
32+
<esri:OverlayItemsControl>
33+
<Border x:Name="mapTip" Background="White" BorderBrush="Black" BorderThickness="2"
34+
Padding="4" Margin="4" HorizontalAlignment="Left" VerticalAlignment="Top"
35+
Visibility="Collapsed" esri:ViewBase.ViewOverlayAnchor="{Binding Geometry}">
36+
<StackPanel>
37+
<TextBlock Text="{Binding Attributes[facname]}" FontWeight="Bold" />
38+
<TextBlock Text="{Binding Attributes[capacity], StringFormat='Capacity: {0}'}" />
39+
</StackPanel>
40+
</Border>
41+
</esri:OverlayItemsControl>
42+
</esri:MapView.Overlays>
43+
</esri:MapView>
44+
</Grid>
4445
</UserControl>

src/Desktop/ArcGISRuntimeSDKDotNet_DesktopSamples/Samples/FeatureLayers/FeatureLayerMapTips.xaml.cs

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,23 @@
88

99
namespace ArcGISRuntimeSDKDotNet_DesktopSamples.Samples
1010
{
11-
/// <summary>
12-
/// This sample shows how to display a map tip for a feature layer. In this example, the MouseMove event of the MapView is handled with code that performs a FeatureLayer HitTest / Query combination which returns a single feature for display in the mapTip element defined in the XAML.
13-
/// </summary>
14-
/// <title>Map Tips</title>
11+
/// <summary>
12+
/// This sample shows how to display a map tip for a feature layer. In this example, the MouseMove event of the MapView is handled with code that performs a FeatureLayer HitTest / Query combination which returns a single feature for display in the mapTip element defined in the XAML.
13+
/// </summary>
14+
/// <title>Map Tips</title>
1515
/// <category>Layers</category>
1616
/// <subcategory>Feature Layers</subcategory>
1717
public partial class FeatureLayerMapTips : UserControl
18-
{
18+
{
1919
private bool _isMapReady;
2020

21-
/// <summary>Construct Map Tips sample</summary>
22-
public FeatureLayerMapTips()
23-
{
24-
InitializeComponent();
21+
/// <summary>Construct Map Tips sample</summary>
22+
public FeatureLayerMapTips()
23+
{
24+
InitializeComponent();
2525

2626
MyMapView.SpatialReferenceChanged += MyMapView_SpatialReferenceChanged;
27-
}
27+
}
2828

2929
private async void MyMapView_SpatialReferenceChanged(object sender, System.EventArgs e)
3030
{
@@ -33,33 +33,33 @@ private async void MyMapView_SpatialReferenceChanged(object sender, System.Event
3333
}
3434

3535
private async void MyMapView_MouseMove(object sender, MouseEventArgs e)
36-
{
36+
{
3737
if (!_isMapReady)
3838
return;
3939

4040
try
41-
{
41+
{
4242
_isMapReady = false;
4343

4444
Point screenPoint = e.GetPosition(MyMapView);
45-
var rows = await earthquakes.HitTestAsync(MyMapView, screenPoint);
46-
if (rows != null && rows.Length > 0)
47-
{
48-
var features = await earthquakes.FeatureTable.QueryAsync(rows);
45+
var rows = await shelters.HitTestAsync(MyMapView, screenPoint);
46+
if (rows != null && rows.Length > 0)
47+
{
48+
var features = await shelters.FeatureTable.QueryAsync(rows);
4949
mapTip.DataContext = features.FirstOrDefault();
50-
mapTip.Visibility = System.Windows.Visibility.Visible;
51-
}
52-
else
53-
mapTip.Visibility = System.Windows.Visibility.Collapsed;
54-
}
55-
catch
56-
{
57-
mapTip.Visibility = System.Windows.Visibility.Collapsed;
58-
}
50+
mapTip.Visibility = System.Windows.Visibility.Visible;
51+
}
52+
else
53+
mapTip.Visibility = System.Windows.Visibility.Collapsed;
54+
}
55+
catch
56+
{
57+
mapTip.Visibility = System.Windows.Visibility.Collapsed;
58+
}
5959
finally
6060
{
6161
_isMapReady = true;
6262
}
63-
}
64-
}
63+
}
64+
}
6565
}

src/Phone/ArcGISRuntimeSDKDotNet_PhoneSamples/Samples/FeatureLayers/FeatureLayerMapTips.xaml

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<Page
2-
x:Class="ArcGISRuntimeSDKDotNet_PhoneSamples.Samples.FeatureLayerMapTips"
3-
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5-
xmlns:local="using:ArcGISRuntimeSDKDotNet_PhoneSamples.Samples"
6-
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
7-
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
2+
x:Class="ArcGISRuntimeSDKDotNet_PhoneSamples.Samples.FeatureLayerMapTips"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:local="using:ArcGISRuntimeSDKDotNet_PhoneSamples.Samples"
6+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
7+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
88
xmlns:esri="using:Esri.ArcGISRuntime.Controls"
99
xmlns:layers="using:Esri.ArcGISRuntime.Layers"
1010
xmlns:data="using:Esri.ArcGISRuntime.Data"
@@ -15,8 +15,11 @@
1515
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
1616
<esri:MapView x:Name="MyMapView" WrapAround="True" >
1717
<esri:Map>
18+
<esri:Map.InitialViewpoint>
19+
<esri:ViewpointExtent XMin="-88.35" YMin="41.61" XMax="-88.05" YMax="41.84" SpatialReferenceID="4326" />
20+
</esri:Map.InitialViewpoint>
1821
<layers:ArcGISTiledMapServiceLayer DisplayName="Basemap"
19-
ServiceUri="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" />
22+
ServiceUri="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" />
2023

2124
<layers:FeatureLayer ID="FeatureLayer">
2225
<layers:FeatureLayer.Renderer>
@@ -30,22 +33,21 @@
3033
</layers:FeatureLayer.Renderer>
3134
<layers:FeatureLayer.FeatureTable>
3235
<data:ServiceFeatureTable
33-
ServiceUri="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/EarthquakesFromLastSevenDays/FeatureServer/0"
34-
Where="magnitude >= 3.0" />
36+
ServiceUri="http://sampleserver6.arcgisonline.com/arcgis/rest/services/NapervilleShelters/FeatureServer/0"/>
3537
</layers:FeatureLayer.FeatureTable>
3638
</layers:FeatureLayer>
3739
</esri:Map>
3840

3941
<esri:MapView.Overlays>
4042
<esri:OverlayItemsControl>
4143
<Border Background="#CC000000" BorderBrush="White" BorderThickness="2" Padding="4"
42-
HorizontalAlignment="Left" VerticalAlignment="Top" IsHitTestVisible="False"
43-
Visibility="Collapsed" esri:ViewBase.ViewOverlayAnchor="{Binding Geometry}">
44+
HorizontalAlignment="Left" VerticalAlignment="Top" IsHitTestVisible="False"
45+
Visibility="Collapsed" esri:ViewBase.ViewOverlayAnchor="{Binding Geometry}">
4446
<StackPanel>
45-
<TextBlock Text="{Binding Attributes[datetime]}" FontWeight="Bold" />
47+
<TextBlock Text="{Binding Attributes[facname]}" FontWeight="Bold" />
4648
<TextBlock>
47-
<Run Text="Magnitude: " />
48-
<Run Text="{Binding Attributes[magnitude]}" />
49+
<Run Text="Capacity: " />
50+
<Run Text="{Binding Attributes[capacity]}" />
4951
</TextBlock>
5052
</StackPanel>
5153
</Border>
Lines changed: 36 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
<Page
2-
x:Class="ArcGISRuntimeSDKDotNet_StoreSamples.Samples.FeatureLayerMapTips"
3-
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
2+
x:Class="ArcGISRuntimeSDKDotNet_StoreSamples.Samples.FeatureLayerMapTips"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
55
xmlns:esri="using:Esri.ArcGISRuntime.Controls"
6-
xmlns:layers="using:Esri.ArcGISRuntime.Layers"
6+
xmlns:layers="using:Esri.ArcGISRuntime.Layers"
77
xmlns:data="using:Esri.ArcGISRuntime.Data"
8-
xmlns:symb="using:Esri.ArcGISRuntime.Symbology">
8+
xmlns:symb="using:Esri.ArcGISRuntime.Symbology">
9+
10+
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
11+
<esri:MapView x:Name="MyMapView" WrapAround="True" >
12+
<esri:Map>
13+
<esri:Map.InitialViewpoint>
14+
<esri:ViewpointExtent XMin="-88.35" YMin="41.61" XMax="-88.05" YMax="41.84" SpatialReferenceID="4326" />
15+
</esri:Map.InitialViewpoint>
916

10-
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
11-
<esri:MapView x:Name="MyMapView" WrapAround="True" >
12-
<esri:Map>
1317
<layers:ArcGISTiledMapServiceLayer DisplayName="Basemap"
14-
ServiceUri="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" />
18+
ServiceUri="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" />
1519

1620
<layers:FeatureLayer ID="FeatureLayer">
1721
<layers:FeatureLayer.Renderer>
@@ -24,28 +28,27 @@
2428
</symb:SimpleRenderer>
2529
</layers:FeatureLayer.Renderer>
2630
<layers:FeatureLayer.FeatureTable>
27-
<data:ServiceFeatureTable
28-
ServiceUri="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/EarthquakesFromLastSevenDays/FeatureServer/0"
29-
Where="magnitude >= 3.0" />
30-
</layers:FeatureLayer.FeatureTable>
31-
</layers:FeatureLayer>
32-
</esri:Map>
33-
34-
<esri:MapView.Overlays>
35-
<esri:OverlayItemsControl>
36-
<Border Background="#CC000000" BorderBrush="White" BorderThickness="2" Padding="4"
37-
HorizontalAlignment="Left" VerticalAlignment="Top" IsHitTestVisible="False"
38-
Visibility="Collapsed" esri:ViewBase.ViewOverlayAnchor="{Binding Geometry}">
39-
<StackPanel>
40-
<TextBlock Text="{Binding Attributes[datetime]}" FontWeight="Bold" />
41-
<TextBlock>
42-
<Run Text="Magnitude: " />
43-
<Run Text="{Binding Attributes[magnitude]}" />
44-
</TextBlock>
45-
</StackPanel>
46-
</Border>
47-
</esri:OverlayItemsControl>
48-
</esri:MapView.Overlays>
49-
</esri:MapView>
50-
</Grid>
31+
<data:ServiceFeatureTable
32+
ServiceUri="http://sampleserver6.arcgisonline.com/arcgis/rest/services/NapervilleShelters/FeatureServer/0"/>
33+
</layers:FeatureLayer.FeatureTable>
34+
</layers:FeatureLayer>
35+
</esri:Map>
36+
37+
<esri:MapView.Overlays>
38+
<esri:OverlayItemsControl>
39+
<Border Background="#CC000000" BorderBrush="White" BorderThickness="2" Padding="4"
40+
HorizontalAlignment="Left" VerticalAlignment="Top" IsHitTestVisible="False"
41+
Visibility="Collapsed" esri:ViewBase.ViewOverlayAnchor="{Binding Geometry}">
42+
<StackPanel>
43+
<TextBlock Text="{Binding Attributes[facname]}" FontWeight="Bold" />
44+
<TextBlock>
45+
<Run Text="Capacity: " />
46+
<Run Text="{Binding Attributes[capacity]}" />
47+
</TextBlock>
48+
</StackPanel>
49+
</Border>
50+
</esri:OverlayItemsControl>
51+
</esri:MapView.Overlays>
52+
</esri:MapView>
53+
</Grid>
5154
</Page>

0 commit comments

Comments
 (0)