Select to view content in your preferred language

Datagrid Binding attributes - Change ISSUE

1035
6
04-03-2011 10:57 PM
vipulsoni
Regular Contributor
I have successfully bind a datagrid and I am getting the results populated ,also after clicking on the results/rows in the datagrid, the graphic layer on the map highlights the graphics by symbol change.

But my issue now is that if I change the querytask parameters, as per user selection criteria for query from code behind my attribute binding in xaml will not work at all... please help me here 🙂

My code for datagrid ---
             <slData:DataGrid x:Name="FindDetailsDataGrid" AutoGenerateColumns="False" HeadersVisibility="All" Background="White"
                                 BorderBrush="Black" BorderThickness="1" RowStyle="{StaticResource MyCustomRow}" SelectionChanged="FindDetailsDataGrid_SelectionChanged" LoadingRow="FindDetailsDataGrid_LoadingRow"
                                 HorizontalScrollBarVisibility="Hidden" Grid.Row="1" CanUserSortColumns="True"
                                 IsReadOnly="True" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                                 Height="Auto" Width="Auto"  >
<slData:DataGrid.Columns>
<slData:DataGridTextColumn CanUserSort="False" Binding="{Binding Attributes[use_]}" Header="Use"/>
                    <slData:DataGridTextColumn CanUserSort="False" Binding="{Binding Attributes[use_type]}" Header="use_type"/>


I have already tried the suggestions given in other forums posts for using esritoolkit featuredatagrid and the code is >>----

  <esritoolkit:FeatureDataGrid x:Name="FindDetailsDataGrid" AutoGenerateColumns="True" HeadersVisibility="All" Background="White"
                                 BorderBrush="Black" BorderThickness="1" RowStyle="{StaticResource MyCustomRow}" SelectionChanged="FindDetailsDataGrid_SelectionChanged" LoadingRow="FindDetailsDataGrid_LoadingRow"
                                 HorizontalScrollBarVisibility="Hidden" Grid.Row="1" CanUserSortColumns="True"
                                 IsReadOnly="True" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                                 Height="Auto" Width="Auto" Map="{Binding ElementName=Map}" GraphicsLayer="{Binding Path=Layers[MyGraphicsLayer], ElementName=Map}" >

but after all tries (try outs / combinations) , my purpose of highlighting the graphics on the graphic layer as per user row selection on datagrid is defeated 😞 ....

esritoolkit:FeatureDataGrid with AutoGenerateColumns="True" -----> this parameter generates rows filled with useless details..


------------------------------
Please guide me on how to have automatic datagrid row populated without binding each attribute , from xaml. Because if I bind attributes in XAML then I cannot modify attributes as per new query. CODE SNIPPET will help.. thnx in advance
0 Kudos
6 Replies
DominiqueBroux
Esri Frequent Contributor
Did you eventually solve your issue after looking at this sample : http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#SpatialQuery ? (as suggested in another thread)
0 Kudos
vipulsoni
Regular Contributor
Did you eventually solve your issue after looking at this sample : http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#SpatialQuery ? (as suggested in another thread)


Thanks, Yes I had solved it and replied to that thread too. But here now I want to change the attribute binding of the datagrid as per my querytask input.

In code behind if else case I will be changing the querytask (query url and the columns to return) but I am not able to change the binding of the attributes of the datagrid. Am I doing something wrong here?
0 Kudos
JenniferNery
Esri Regular Contributor
If you need to edit graphic.Attributes and push this change to the server, you need to use FeatureLayer.
0 Kudos
vipulsoni
Regular Contributor
If you need to edit graphic.Attributes and push this change to the server, you need to use FeatureLayer.


Hi Jennifer,

Thanks for your reply, I dont want to edit the attributes. I just want to display another set of attributes since my query task will change from time to time. Because as much I know about silverlight if I bind datagrid columns to attributes I cannot change those binding values at runtime again for another querytask with different field return values.
0 Kudos
DominiqueBroux
Esri Frequent Contributor
This thread about column definition by code may help : http://forums.arcgis.com/threads/12341-Defining-Results-Datagrid-In-Code-behind
0 Kudos
vipulsoni
Regular Contributor
This thread about column definition by code may help : http://forums.arcgis.com/threads/12341-Defining-Results-Datagrid-In-Code-behind


Thank you very much Dominique and Jennifer, for your time 🙂 all your suggestions really helped me for getting the solution.

sometimes I miss those ADF application days...
0 Kudos