Greetings to the enlightened ones!
I'm playing on this for several hours now, but wasn't successful (perhaps because I'm quite new to WPF):
I have a DataGrid whose DataContext is bound to a DataTable. The DataGrid is of fixed size and its purpose is to hold a value table y(x) (i.e. the headers show the x-values and the corresponding y-values are pasted from the clipboard and shown in the first DataGridRow). So far so good. The values are pasted (assigned as strings to dataTable.rows[0][i] where i=0...n) perfectly and displayed well.
But the numbers displayed are percent-values and I want them to be displayed as such:
"0.18" shall become "18 %"
So, I decided to cope with this using a style which is to be applied to all DataGridCell objects:
<Style TargetType="{x:Type Controls:DataGridCell}">
<Style.Setters>
<Setter Property="ContentStringFormat" Value="{}{0:P}"/>
<Setter Property="Foreground" Value="DarkGray"/>
<Setter Property="Background" Value="Yellow"/>
</Style.Setters>
</Style>
Then the background and foreground colors are adopted fine, but the numbers are still displayed as decimals (i.e. "0.18" still reads "0.18".
How can I fix this?
Thanks in advance Joerg