Select to view content in your preferred language

How do I control the Infowindow height

2415
10
02-08-2011 11:18 AM
JamesMolohon
Emerging Contributor
I am trying the Infowindow tool, but have been unable to view all of the items in the data template. I can only read the first line, the window doesn't seem to resize based on content.  How do I fix this?
  My data template looks like this:
        <DataTemplate x:Key="LocationInfoWindowTemplate">
            <StackPanel>
                <TextBlock Text="Coordinates" />
                <TextBlock Text="{Binding [DegMinSec]}" />
                <TextBlock Text="{Binding [DecDeg]}" />
            </StackPanel>
        </DataTemplate>
0 Kudos
10 Replies
JenniferNery
Esri Regular Contributor
Are you using this SDK sample?http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#InfoWindowSimple

I tried to modify the DataTemplate to include multiple TextBlocks and all of them were displayed without adjusting the InfoWindow Height. Maybe you can check if the Binding is correct, you can use FallBackValue property.

Text="{Binding [DegMinSec], FallbackValue=Binding failed}"
0 Kudos
JeffRogholt
Emerging Contributor
I'm unable to increase the height of the InfoWindow beyond what is seen in the attach picture.  It isn't displaying the entire picture in the last row.  Is there a max height for this control in Silverlight?  I've looked at the example in the Resource Center and we have modeled ours from it.  Below is the xaml for the data template.  Any help is appreciated.

            
<DataTemplate x:Key="LocationInfoWindowTemplate">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="30" />
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="Auto"  />
                    </Grid.ColumnDefinitions>

                    <Rectangle  Grid.Row="0" Grid.ColumnSpan="3" Fill="#00FFFFFF"/>
                    <Rectangle  Grid.Row="1" Grid.ColumnSpan="3" Fill="#DDEAEFF4" />
                    <Rectangle  Grid.Row="2" Grid.ColumnSpan="3" Fill="#00FFFFFF"/>
                    <Rectangle  Grid.Row="3" Grid.ColumnSpan="3" Fill="#DDEAEFF4" />
                    <Rectangle  Grid.Row="4" Grid.ColumnSpan="3" Fill="#00FFFFFF"/>
                    <Rectangle  Grid.Row="5" Grid.ColumnSpan="3" Fill="#DDEAEFF4" />

                    <TextBlock Text="{Binding [myXY_L]}"   Grid.Row="0" Grid.Column="1" Margin="5,0,0,0"  />
                    <TextBlock Text="{Binding [myXY_R]}"   Grid.Row="0" Grid.Column="2" Margin="5,0,0,0"  />
                    <Ellipse Grid.Row="0" Grid.Column="4" Margin="70,-10,-5,3"  Stroke="LightGray" StrokeThickness="1" Fill="White" Width="16" Height="16" />
                    <Image Source="Images/GenericDeleteBlackSmall16.png"  Grid.Row="0" Grid.Column="4" Margin="70,-10,-5,3" Height="14" Width="14"/>

                    <TextBlock Text="DMS" Grid.Row="1" HorizontalAlignment="Left" />
                    <TextBlock Text="{Binding [myDMS_L]}"  Grid.Row="1" Grid.Column="1" Margin="5,0,0,0"  />
                    <TextBlock Text="{Binding [myDMS_R]}"  Grid.Row="1" Grid.Column="2" Margin="5,0,0,0"  />

                    <TextBlock Text="DDM" Grid.Row="2" HorizontalAlignment="Left"   />
                    <TextBlock Text="{Binding [myDDM_L]}"  Grid.Row="2" Grid.Column="1" Margin="5,0,0,0"  />
                    <TextBlock Text="{Binding [myDDM_R]}"  Grid.Row="2" Grid.Column="2" Margin="5,0,0,0"  />

                    <TextBlock Text="DD"  Grid.Row="3" HorizontalAlignment="Left" />
                    <TextBlock Text="{Binding [myDD_L]}"   Grid.Row="3" Grid.Column="1" Margin="5,0,0,0"  />
                    <TextBlock Text="{Binding [myDD_R]}"   Grid.Row="3" Grid.Column="2" Margin="5,0,0,0"  />

                    <Image x:Name="coorImg1b" Grid.Row="4" Grid.RowSpan="2" Grid.Column="0" Grid.ColumnSpan="3" Source="Images/google.png" Height="16" Width="16" Margin="0,2,0,0" MouseLeftButtonDown="coorImg1_MouseLeftButtonDown" ToolTipService.ToolTip="{Binding [tooltip1]}" VerticalAlignment="Top" HorizontalAlignment="Left"/>
                    <Image x:Name="coorImg2b" Grid.Row="4" Grid.RowSpan="2" Grid.Column="0" Grid.ColumnSpan="3" Source="Images/bing.png" Height="16" Width="16" Margin="19,2,0,0" ToolTipService.ToolTip="{Binding [tooltip2]}" VerticalAlignment="Top" HorizontalAlignment="Left"/>
                    <Image x:Name="coorImg3b" Grid.Row="4" Grid.RowSpan="2" Grid.Column="0" Grid.ColumnSpan="3" Source="Images/mapquest.png" Height="16" Width="16" Margin="38,2,0,0" ToolTipService.ToolTip="{Binding [tooltip3]}" VerticalAlignment="Top" HorizontalAlignment="Left"/>

                </Grid>
            </DataTemplate>
0 Kudos
komalagarwal
Deactivated User
I am also facing the same issue? Can you please share your solution in case your query is resolved?
0 Kudos
JenniferNery
Esri Regular Contributor
I tried code snippet from post# 3 and replaced only the attributes and image source. The last row of images does not get cut-off for me. Kindly see attached.
0 Kudos
deleted-user-ATjHIWsdQYmT
Deactivated User
For those of you having an issue with not being able to resize the infowindow, do you have your map inside a grid?  I've found that if the map is inside a grid (i.e. Grid.Row=1 Grid.Column=1) then the infowindow doesn't display properly.  IF you specify a grid row/column for the infowindow, it shows up offset.  I think it might be a bug..
0 Kudos
JenniferNery
Esri Regular Contributor
I am not able to reproduce what you describe with v2.1 assemblies. Can you share with us some code?

I am using the code from: http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#InfoWindowSimple

With the following update on XAML:
  <Grid.RowDefinitions>
   <RowDefinition/>
   <RowDefinition/>
  </Grid.RowDefinitions>
  <Grid.ColumnDefinitions>
   <ColumnDefinition/>
   <ColumnDefinition/>
  </Grid.ColumnDefinitions>
   <esri:Map x:Name="MyMap" Grid.Row="1" Grid.Column="1" Extent="-15000000,2000000,-7000000,8000000" MouseClick="MyMap_MouseClick">

0 Kudos
deleted-user-ATjHIWsdQYmT
Deactivated User
Attached is a text file with all my XAML Code.

At the very bottom you will see the code for the InfoWindow.  In order to make it align properly I have to give it a top margin of -75 and place it in Grid.Column = "1" and Grid.Row = "1". That's the same location as the map.  If I don't specify a grid row/column the InfoBox does not size properly (i.e. It doesn't size large enough to include all of the items in the DataTemplate for the InfoWindow).  If I DO specify the grid row/column but don't give it the proper margin, the InfoBox falls off the page.

-Andrew
0 Kudos
dotMorten_esri
Esri Notable Contributor
Make sure the InfoWindow is placed within the same row/grid as the map, and no margin is assigned to it.
0 Kudos
deleted-user-ATjHIWsdQYmT
Deactivated User
That's what I've done.  Map is in grid/column 1..
<esri:Map x:Name="MainMap" MouseClick="MainMap_MouseClick" BorderBrush="black" IsLogoVisible="False" Background="White" Grid.Column="1" Grid.Row="1">


InfoWindow in Grid/Column 1..
           
<esri:InfoWindow x:Name="MyInfoWindow"
                         CornerRadius="10" 
                         Background="#CCFFFFFF"
          Map="{Binding ElementName=MainMap}"
                   ContentTemplate="{StaticResource MyFeatureLayerInfoWindowTemplate}"
                         MouseLeftButtonUp="MyInfoWindow_MouseLeftButtonUp" Grid.Row="1" Grid.Column="1"/>


Returns Attached image: "GridRow1 (2) (Small).png"

When using (specify Row but no Column and a margin offset):
      <esri:InfoWindow x:Name="MyInfoWindow"
                         CornerRadius="10" 
                         Background="#CCFFFFFF"
          Map="{Binding ElementName=MainMap}"
                   ContentTemplate="{StaticResource MyFeatureLayerInfoWindowTemplate}"
                         MouseLeftButtonUp="MyInfoWindow_MouseLeftButtonUp" Grid.Row="1" d:LayoutOverrides="VerticalAlignment" Margin="0,-75,0,0"/>


I get the results shown in "RowOnly(small).png"
0 Kudos