Select to view content in your preferred language

Info Window

947
7
02-23-2011 11:13 AM
BrianGustafson
Occasional Contributor
I am trying to put a datagrid inside of an info window and then bind the datagrid to the graphics attributes.  When I open the info window the grid shows up blank,  what is wrong with this code?

<DataTemplate x:Key="MyFeatureLayerInfoWindowTemplate">
                <!--<TextBlock Text="{Binding [OWNERNAME1]}" Foreground="Black" FontSize="12" />-->
                <ScrollViewer Margin="0,5,0,0" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Width="285" Height="325">
                    <slData:DataGrid AutoGenerateColumns="False" HeadersVisibility="None">
                            <slData:DataGrid.Columns>
                                <slData:DataGridTextColumn Binding="{Binding Path=Key}" FontWeight="Bold"/>
                                <slData:DataGridTemplateColumn>
                                    <slData:DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <TextBlock Text="{Binding Path=Value}" />
                                        </DataTemplate>
                                    </slData:DataGridTemplateColumn.CellTemplate>
                                </slData:DataGridTemplateColumn>
                            </slData:DataGrid.Columns>
                    </slData:DataGrid>
                </ScrollViewer>
            </DataTemplate>

MyInfoWindow.Content = g.Attributes;
0 Kudos
7 Replies
BrianGustafson
Occasional Contributor
I figured it out, I was missing a binding statement.
0 Kudos
komalagarwal
Deactivated User
Hi

I am very new to silverlight. I am facing the same issue, But I dont know how to bind the data.
Can you please share you solution.

Thanks in advance
0 Kudos
BrianGustafson
Occasional Contributor
I forgot to add this property in the XAML for the datagrid.

ItemsSource="{Binding}"
0 Kudos
komalagarwal
Deactivated User
Thanks a lot Brian for your solution.

I have another question: when i bind my data to datagrid, I am not able to see the complete datagrid.
The reason is I am not able to increase the size of infoWindow. Did you face a similar issue?

My Question: Can we resize the height of infowindow in Silverlight4? If yes, How?

Any help with respect to the same is appreciated 🙂
0 Kudos
BrianGustafson
Occasional Contributor
You can just put the datagrid inside of a slide control so that when the datagrid is too large scrollbars appear.
0 Kudos
karenvolarich
Occasional Contributor
Is there a way to put a title/label at the top of the info window for showing the name of the layer?
0 Kudos
JenniferNery
Esri Regular Contributor
0 Kudos