Is there a way to change the column headers of a SL2 datagrid during databinding? I'm looking for something similar to ASP.net's rowDataBound, I'm looking at _LoadingRow is this the correct event?
+1
A:
You can bind DataColumns in your XAML
<data:DataGridTextColumn Header="Latitude" Binding="{Binding lat}" IsReadOnly="True" />
Henrik P. Hessel
2009-06-10 20:31:56
A:
Why would you change column headers based on row data. Binding/changing column headers should not be row driven.
Cody C
2009-06-10 20:36:02
This should be a comment rather than an answer.
Jeff Yates
2009-06-10 20:43:52
A:
As suggested by rAyt in their answer, you can add bindings to the columns. With an appropriate binding and possibly a value converter, you could use this mechanism to update the headers.
You can also set the DataGrid
to auto-generate columns based on the collection data. You may find this a better route. You can also modify the auto-generated columns as described by this MSDN article.
Jeff Yates
2009-06-10 20:45:27