Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am wanting to display information in an InfoWindow when the user clicks on a point on the map. I have implemented the InfoWindow in XAML, but I do not understand the code behind it. Any information will be appreciated. Here is my (what I feel is relevant) XAML:

 <esri:InfoWindow x:Name="MyInfoWindow"
                             Background="{StaticResource PanelGradient}"
                             Map="{Binding MyMap}"
                             ContentTemplate="{StaticResource MyFeatureLayerInfoWindowTemplate}"
                         MouseLeftButtonUp="MyInfoWindow_MouseLeftButtonUp" />

If you need anymore information, let me know. I have the information being displayed correctly at the moment in a MapTip. Here is the XAML for that:

                        <Border CornerRadius="10" BorderBrush="Black" BorderThickness="2" Margin="0,0,15,15" Background="{StaticResource PanelGradient}">
                            <StackPanel Margin="7">
                                <TextBlock Text="{Binding [WVAL_ID], StringFormat='ID: \{0\}'}" FontWeight="Bold" Foreground="White"  />
                                <TextBlock Text="{Binding [SIZE], StringFormat='Size: \{0\}'}" FontWeight="Bold" Foreground="White" />
                                <TextBlock Text="{Binding [WVAL_USE], StringFormat='Use: \{0\}'}" FontWeight="Bold" Foreground="White" />
                                <TextBlock Text="{Binding [WVAL_TYPE], StringFormat='Type: \{0\}'}" FontWeight="Bold" Foreground="White"  />
                                <TextBlock Text="{Binding [OPENS], StringFormat='Opens: \{0\}'}" FontWeight="Bold" Foreground="White"  />
                                <TextBlock Text="{Binding [TURNS], StringFormat='Turns: \{0\}'}" FontWeight="Bold" Foreground="White"  />
                                <StackPanel Orientation="Horizontal" >

share|improve this question
up vote 1 down vote accepted

I finally figured it out for the most part...


<esri:InfoWindow x:Name="MyInfoWindow"
                             Background="{StaticResource PanelGradient}"
                             Map="{Binding ElementName=MyMap}"
                             ContentTemplate="{StaticResource MyFeatureLayerInfoWindowTemplate}">                


MapPoint lastPoint = null;

        private void FeatureLayer_MouseLeftButtonUp(object sender, GraphicMouseButtonEventArgs e)
            FeatureLayer flayer = sender as FeatureLayer;

            MapPoint clickpoint = MyMap.ScreenToMap(e.GetPosition(MyMap));

            if (clickpoint != lastPoint)
                MyInfoWindow.Anchor = clickpoint;
                MyInfoWindow.Content = e.Graphic.Attributes;
                MyInfoWindow.IsOpen = true;
                lastPoint = clickpoint;
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.