Select to view content in your preferred language

Reposition popup

63
1
Friday
Labels (1)
JustinTrody
Occasional Contributor

Hi, I am using the following wpf to create a popup when clicking on feature on map. The popup sometimes displays outside of the view window.

I would like to display the popup always in the centre of the map screen.  

 

Any ideas??

 

<esri:MapView.Overlays>
    <esri:OverlayItemsControl>
        <Grid x:Name="popup" Visibility="Visible"
          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="#FFFFFF" BorderThickness="1,1,1,0" Margin="0,0,-33,19" BorderBrush="White" Grid.ColumnSpan="2" Grid.RowSpan="2">
                <StackPanel Margin="20" x:Name="MyStackPanel"/>
</Border>
      
        </Grid>
    </esri:OverlayItemsControl>
</esri:MapView.Overlays>
0 Kudos
1 Reply
dotMorten_esri
Esri Notable Contributor

Have you considered using the ShowCalloutAt method instead? This will host your UI element and move it around to keep it on top of the map.

A more advanced method would be to create a custom control yourself to host your content, and have that implement IViewOverlay interface, which will give you the information needed to re-arrange the view yourself (this is also what the callout uses to do this).

0 Kudos