Setting DataGrid RowStyle based on a property in my bound ItemsSource

Nov 12, 2009 at 4:34 PM

Hi,

I have an ObservableCollection of "Foo" objects which I am using as the ItemsSource for a DataGrid. Foo has a boolean property "CanAck" and I'd like to set the RowStyle based on this bool. I already have a style defining foreground and background colours which works fine but I'd like to invert these if the value of "CanAsk" is false. Can anyone point me int he right direction?

Cheers

Rich

Coordinator
Nov 14, 2009 at 12:50 AM

RowStyleSelector would give you the functionality to change the full style depending upond the data in that row. http://msdn.microsoft.com/en-us/library/system.windows.controls.datagrid.rowstyleselector(VS.100).aspx

Thanks.