views:

244

answers:

2

Ok this is driving me mad, I feel like a total Newbie.

I'm using WPF's DataGrid control from WPF Toolkit with .NET 3.5.
Link on Codeplex here

I want an equivalent to the classic GridView's RowDataBound event, and I can't find any. I tried working with LoadingRow, but it fires every time I scroll.

I'm trying to change the background color of certain cells in my grid based on a database values.
I'm new to WPF. Should I be using the XAML binding?

+1  A: 

The apt way of doing that in WPF is through Datatrigger

<DataTrigger Binding="{Binding Path=State}" Value="WA">
    <Setter Property="Foreground" Value="Red" />
</DataTrigger>  

that comprehends to

UPDATE DataGrid
SET Foreground = 'Red'
WHERE State = 'WA';
Veer
A: 

I ended up disabling row virtualization on the DataGrid using EnableRowVirtualization="False". That way, the LoadingRow event would fire only once for all items.

SiN