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
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 }
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!