WPF 4.0 Datagrid ignores stringformat

Oct 19, 2010 at 10:01 AM
Edited Oct 19, 2010 at 10:23 AM

I've been looking for hours now to get Stringformatting work in my datagrid...

I have got it working on a textbox or a textblock:

<TextBox Name="txtTEST" Text="{Binding Mode=OneWay, StringFormat=C, ConverterCulture=nl-BE}"/>
<TextBlock Name="txtTEST2" Text="{Binding Mode=OneWay, StringFormat=C, ConverterCulture=de-DE}"/>

On my Datagrid however it doens't work properly and I tried two different ways:

<DataGridTextColumn Binding="{Binding  Path=PrijsVK, StringFormat='C', ConverterCulture='nl-BE', Mode=OneWay}" Header="PrijsVK" Width="75" MinWidth="50" MaxWidth="125" CellStyle="{DynamicResource DataGridCellStyleRight}"/>
<DataGridTemplateColumn Header="Totaal" Width="75" MinWidth="50" MaxWidth="125" CellStyle="{DynamicResource DataGridCellStyleRight}">
              <TextBlock Text="{Binding Path=Totaal, StringFormat=C, ConverterCulture=nl-BE, Mode=OneWay}"/>

Even in the last try with the datatemplate I tried also with a textbox, but no help there...