Need to create a data grid with configurable columns. In that the cell colors will changes according to the data bind.

The cell color change can be done through above code.
But i need to generate dynamic columns through c# code (in mvvm, ViewModel class).
or
can any one give me the code above in c#.
Can any one help me...
I have spent lots of day on googling...
The end result is null;
Im getting my data grid item source through ObservableCollection<Interface>.