Hi,
Silverlight datagrid exposes an event “LoadingRow”. This event Occurs after a DataGridRow is instantiated.
Adding the event in xaml:
<sdk:DataGrid AutoGenerateColumns="True" Height="217"
HorizontalAlignment="Stretch"
LoadingRow="dataGrid1_LoadingRow"
Margin="4,45,0,0" Name="dataGrid1"
VerticalAlignment="Top"
/>
Adding the code in .cs file
private void dataGrid1_LoadingRow(object sender, DataGridRowEventArgs e)
{
Book book = e.Row.DataContext as Book;
if (book != null)
{
double price = double.Parse(book.price);
if (price > 5)
{
e.Row.Background = new SolidColorBrush(Colors.Green);
}
}
}
In the event handler we are highlighting the books priced more than 5.
Any more information you can refer to the link:
http://sudhirdotnet.wordpress.com/2011/11/04/silverlight-datagrid-change-row-color-based-on-some-value/
Best Wishes!
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. Thanks<br/> MSDN Community Support<br/> <br/> Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and
makes it easier for other visitors to find the resolution later.