'How to add highlight color to text in wpf datagrid

I have a DataGrid that uses ItemsSource for data binding. I want all my cells in that DataGrid to be highlighted with a certain color

<DataGrid 
     FontSize="12" 
     x:Name="MyGrid"
     ItemsSource="{Binding DataContext.GridItems, ElementName=MyWindow, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
     InitializingNewItem="MyGrid_InitializingNewItem">
</DataGrid>

I want it to look something like this, but to highlight the trailing or leading whitespaces (if there are any) enter image description here

Can someone help me with this? Thanks!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source