Universal Windows Platform (UWP)
A Microsoft platform for building and publishing apps for Windows desktop devices.
2,979 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Everytime I click a pushpin in my MapControl the Popup always appears in the top-left corner of the MapControl. How can this be changed so that it appears above the pushpin itself?
MainPage.xaml
<Page
x:Class="MyApp.PageMap"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:MyApp"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Maps="using:Windows.UI.Xaml.Controls.Maps"
mc:Ignorable="d">
<Grid x:Name="GridMap">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Maps:MapControl
Grid.Row="0"
x:Name="MyMapControl"
ZoomLevel="8"
MapElementClick="MyMapControl_MapElementClick">
<Popup x:Name="PushpinPopup" IsLightDismissEnabled="True">
<Grid Background="Black">
<TextBlock Text="Hello World"/>
</Grid>
</Popup>
</Maps:MapControl>
</Grid>
</Page>
Try with this
private void MyMapControl_MapElementClick(MapControl mapControl, MapElementClickEventArgs args)
{
Point point = args.Position;
PushpinPopup.HorizontalOffset = point.X;
PushpinPopup.VerticalOffset = point.Y;
PushpinPopup.IsOpen = true;
}