Search code examples
c#wpftelerik

Gridviewcell showing wrong thousand seperator


I have a radgridview (is from telerik, but it's like a DataGrid) with multiple decimal columns. They should be shown like this: 10'000.00

That's working correctly with this:

<telerik:GridViewDataColumn Header="Total" DataMemberBinding="{Binding Total, StringFormat=N2}">

But if I edit the cell it is show in a wrong format: enter image description here

So I tried to create a CellEditTemplate:

<telerik:GridViewDataColumn Header="Betrag Holzbau" DataMemberBinding="{Binding Total, StringFormat=N2}">
     <telerik:GridViewDataColumn.CellEditTemplate>
         <DataTemplate>
             <telerik:RadWatermarkTextBox Text="{Binding Total, StringFormat=N2}"/>
         </DataTemplate>
     </telerik:GridViewDataColumn.CellEditTemplate>
 </telerik:GridViewDataColumn>

But this shows a wrong thounsand separator (’ instead of '): enter image description here

How can I set the format always to this 10'000.00


Solution

  • You should be able to set the Language property of the TextBox to a culture in the CellEditTemplate to format the number according to that culture.

    Then you "only" need to find a culture that uses ' or create your own custom culture.

    Another option may to format the value yourself, for example using a value converter.