Datagrid: How to style each cell individually based on style information stored with the data

Oct 30, 2008 at 1:07 PM
Edited Oct 30, 2008 at 5:00 PM

Is there a way to implement cell level styling in the datagrid , whereby each data element in the grid would carry its own style information.
The user should then be able to change the style (format) of  each cell at runtime and store the format information with the data.
(similar to how cells can be formatted individually in excel ...)

I have tried something like



dg:DataGridTextColumn CellStyle="{Binding  Path=IdStyle}" Header="Index" DataFieldBinding="{Binding Path=Id}" />


where IdStyle is a parameter of type Style of the data bound to the grid. 

But this seems not to work.  

Any ideas

Nov 3, 2008 at 9:04 PM
Edited Nov 3, 2008 at 9:05 PM

It looks like you need to use Converter for your binding and based of input string (you might use Regular Expressions to analyze input), convert entered string into value that you want to.                                                         Thanks.Lena