What's the simplest way to format numbers appearing in a particular column of the grid. For example if I want the number 1234.56 to appear as 1,234.5600.
Hello,
You can set the masks and format properties of the editor (EditorStyle property of the field).
You can see the default masks here. This will display this when the editor is in edit mode. If you want when the editor is not in edit mode, you can set the Format property using standard .net formatting.
Thanks for the reply.
I'm interested in the format when not in edit mode at this stage. When you say set the Format property, set the Format property of what exactly ?
Hopefully we're nearly there.
Could you provide some sample code (VB or C#) as opposed to sample XAML. I assume this will begin as shown below. If you could fill in the blanks that would be great. Thanks.
Dim Field As Field = Grid.LayoutSettings.Item(0).Fields("Field1")
Field.Settings.EditorStyle....
You do not have to create the whole style in code behind. You can set the x:Key attribute of the style and get it as a resource by this key from where you have defined it.
Let's say that a particular column is displaying numeric data with 2 decimals places and you want to allow the user to increase the number of decimal places displayed in this column by clicking an appropriate toolbar button. How could this be done ?
Dim style As New Style(GetType(XamNumericEditor))
Dim s As New Setter(XamNumericEditor.FormatProperty, "##0.00")
style.Setters.Add(s)
This is the code in VB for the style. You can apply it to the specific Field's Settings.
That's what I was looking for. Thanks.