jr3
jr3

Reputation: 915

Silverlight 2 datagrid headers

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?

Upvotes: 0

Views: 275

Answers (2)

Jeff Yates
Jeff Yates

Reputation: 62377

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.

Upvotes: 0

Henrik P. Hessel
Henrik P. Hessel

Reputation: 36617

You can bind DataColumns in your XAML

 <data:DataGridTextColumn Header="Latitude" Binding="{Binding lat}"  IsReadOnly="True"  />

Upvotes: 1

Related Questions