I am migrating code from .net 10.2. to 100.9.0. We use overlays to show details when the user hovers on a feature. However I can't find how to set the coordinates of the overlay in 100.9.0 (so it appears by the mouse cursor).
XAML:
<esri:MapView x:Name="CenterlineHistoryMapView" WrapAround="True" MouseMove="CLHistMapView_OnMouseMove">
...
<esri:MapView.Overlays>
<esri:OverlayItemsControl>
<Border x:Name="MapTooltip"
Background="White"
BorderBrush="Black" BorderThickness="2"
Padding="4" Margin="4"
HorizontalAlignment="Left" VerticalAlignment="Top"
Visibility="Collapsed">
<StackPanel x:Name="ToolTipStackPanel">
<TextBlock Text="{Binding Attributes[LINE_DESCRIPTION], StringFormat='Line Description: {0}'}" Foreground="Black" FontWeight="Bold" />
<TextBlock Text="{Binding Attributes[ROUTE_ID], StringFormat='Route Id: {0}'}" Foreground="Black" />
<TextBlock Text="{Binding Attributes[DESIGNATOR], StringFormat='Designator: {0}'}" Foreground="Black" />
</StackPanel>
</Border>
</esri:OverlayItemsControl>
</esri:MapView.Overlays>
</esri:MapView>
Code behind:
// rectangle is derived from mouse event location
// I have migrated some of the code to the 100.9 API, like using IdentifyLayerAsync method
long[] rows = await _centerlineFeatureLayer.HitTestAsync(CenterlineHistoryMapView, rectangle);
if (rows != null && rows.Length > 0)
{
IEnumerable<Feature> features = await _centerlineFeatureLayer.FeatureTable.QueryAsync(rows);
Feature feature = features.FirstOrDefault();
if (feature != null)
{
_hoverOverlay.Graphics.Add(new Graphic(feature.Geometry, _hoverLineSymbol));
MapTooltip.DataContext = feature;
MapTooltip.Visibility = Visibility.Visible;
//Looking for the equivalent of this call in 100.9.0
Esri.ArcGISRuntime.Controls.ViewBase.SetViewOverlayAnchor(MapTooltip,
CenterlineHistoryMapView.ScreenToLocation(screenPoint));
}
else
{
MapTooltip.Visibility = Visibility.Collapsed;
}
}
On a side note, is would this be better suited as a popup? I'm not understanding the difference between a popup and an overlay.