I was just writing a simple popup today so here is what I did.
<esri:MapView x:Name="MyMapView">
<esri:MapView.Overlays>
<esri:OverlayItemsControl>
<Grid x:Name="popup"
esri:MapView.ViewOverlayAnchor="{Binding Geometry}"
IsHitTestVisible="False" HorizontalAlignment="Right" VerticalAlignment="Top" MaxWidth="200">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="20" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Border Background="#CC000000" BorderThickness="1,1,1,0" Margin="0,0,0,-1" BorderBrush="White" Grid.ColumnSpan="2">
<StackPanel Margin="20">
<TextBlock FontWeight="Bold" Foreground="White">
<Run Text="ObjectId = "></Run>
<Run Text="{Binding Attributes[objectid]}"></Run>
</TextBlock>
</StackPanel>
</Border>
<Path StrokeThickness="1" Fill="#CC000000" Stroke="White" Stretch="Fill" HorizontalAlignment="Left" Data="M0,0 L0,1 1,0" Grid.Row="1" />
<Path StrokeThickness="1" Fill="#CC000000" Stroke="White" Stretch="Fill" VerticalAlignment="Top" Data="M0,0 L1,0" Grid.Row="1" Grid.Column="1" />
</Grid>
</esri:OverlayItemsControl>
</esri:MapView.Overlays>
</esri:MapView>
And in your code you can do following
private ArcGISFeature _selectedFeature;
private async void OnGeoviewTapped(object sender, GeoViewInputEventArgs e)
{
try
{
foreach (var featureLayer in MyMapView.Map.OperationalLayers.OfType<FeatureLayer>())
{
featureLayer.ClearSelection();
}
var results = await MyMapView.IdentifyLayersAsync(e.Position, 2, false, 1);
if (results.Any())
{
var result = results.First();
var feature = result.GeoElements.First() as ArcGISFeature;
await feature.LoadAsync();
var layer = result.LayerContent as FeatureLayer;
var objectIdField = (layer.FeatureTable as ArcGISFeatureTable).ObjectIdField;
if (_selectedFeature?.Attributes[objectIdField]?.ToString() ==
feature.Attributes[objectIdField]?.ToString())
{
popup.Visibility = Visibility.Collapsed;
popup.DataContext = null;
_selectedFeature = null;
}
else
{
layer.SelectFeature(feature);
popup.DataContext = feature;
popup.Visibility = Visibility.Visible;
_selectedFeature = feature;
}
}
else
{
popup.Visibility = Visibility.Collapsed;
popup.DataContext = null;
}
}
catch (Exception ex)
{
MessageBox.Show("An error occurred. " + ex.ToString(), "Sample error");
}
}
Note that the implementation might differ depending what you want to do. In my case I want to show a callout when clicking a feature isn't currently selected. If the feature is currently selected, then I want to hide the callout and if nothing is located where I click, I want to reset the map.