Is it possible to change the decimal symbol and thousands separater?
I have a requiement to show the decimal point and seperater as potentially any other character specified by our users. Any ideas?
I have tried altering the format property of the column but this does not work correctly. So i have replaced the , with a : and the . with a - in the format and this is the result.
:100-00 when the normal value is actually 10,000.00
What's the DataType of the column you are working with?
Assuming it's a numeric type, then you could apply a MaskInput on the column that picks up the system settings for the decimal and separator. But I don't think there's any easy way to specify particular characters that are not set in the system itself.
I suppose another option would be to create an unbound column and then you could read the value from the "real" column and replace the decimals and separators with whatever you want and display them as a string in the unbound column. But then you would lose the ability to mask the input (assuming the field is editable).
The column will not be editable and the decimal points and seperaters can be different from the system settings.
I think the suggestion of creating the unbound column might work, or that i might even be able to do a replace on the text inside the cells itself, This would however mess up the columns totals i have but i might be able to figure that one out.
Thanks
Ok so i am able to create the dummy columns and replace the decimal poitn and thousands seperater fine. The only problem that i have remaining is that i need to create a rowsummary
Currenlty i have a row summary on the bottom of my correct decimal row, well a summary that sums up the decimal column and then outputs underneath the column i have made into strings. the problem i have of course is that the thousands seperater and decimal point are not the same on the summary row.
I am wondering whether some how i can sum the values up onto the bottom of my hidden columns and then create a custome rowsummary on the string column, which is equal to the value of the real one, with the dcimal nd seperater replaced. Make sense? I confused myself writing this!
Thanks Mike. Becasue i was looking in the designer view that particular property was not showing (of course it couldnt as needs to be set to an instance of a class at runtime) All is now working fantastically. Thankyou very much for all your help
Hi Richard,
I'm sorry, but I don't understand your question. You don't have to change your summaries, the CreationFilter changes the text on the summary for you.
To assign this CreationFilter to the grid, you simply use the grid's CreationFilter property and set it to an instance of the class I defined here.
Thank Mike.
How do i go about changing my summaries to incorporate this?
Hi,
I think you will want to create your summary on the "real" column, so that it can have the correct total and then you need to change the display to show the correct decimal and separator.
There are a coupe of ways you could do that:
1) You could create an ICustomSummaryCalculator. This way you can return whatever value you want as the result of your summary. The down side of this approach is that you have to do the calculation of the summary yourself, too - it's all or nothing.
2) You could use a CreationFilter to simply change the Text of whatever UIElement is displaying the summary.
I'd go with approach 2, myself. Here's some quick sample code that I whipped up that does what you want:
public class MySummaryCreationFilter : IUIElementCreationFilter { #region IUIElementCreationFilter Members public void AfterCreateChildElements(UIElement parent) { SummaryValueUIElement summaryValueUIElement = parent as SummaryValueUIElement; if (summaryValueUIElement != null) { TextUIElement textElement = summaryValueUIElement.GetDescendant(typeof(TextUIElement)) as TextUIElement; if (textElement == null) { Debug.Fail("Failed to get a TextUIElement in the SummaryValueUIElement; unexpected"); return; } SummaryValue summaryValue = summaryValueUIElement.GetContext(typeof(SummaryValue)) as SummaryValue; if (summaryValue == null) { Debug.Fail("Failed to get SummaryValue from summaryValueUIElement; unexpected"); return; } if (summaryValue.SummarySettings.Key == "MySummary") textElement.Text = summaryValue.SummaryText.Replace(".", "X"); } } public bool BeforeCreateChildElements(UIElement parent) { // do nothing. return false; } #endregion }