Hi,
It seems that EditType for xamNumericEditor is double, can we change this to Int so that it will show only whole numbers without decimals.
Also I need to set this xamNumericEditor format from the CultureInfo. I tried by setting 'editor.FormatProvider = new CultureInfo("en-GB");',
but this doesnt works.
How can I achieve this through code? Can somebody help me in this regard?
Try this:
var numericStyle = new Style(typeof(XamNumericEditor)); numericStyle.Setters.Add(new Setter(XamNumericEditor.FormatProperty, null)); numericStyle.Setters.Add(new Setter(XamNumericEditor.FormatProviderProperty, CultureInfo.CurrentCulture)); numericStyle.Setters.Add(new Setter(XamNumericEditor.ValueTypeProperty, typeof(double)));
field.Settings.EditorStyle = numericStyle; field.Settings.EditorType = typeof(XamNumericEditor);
Alex,
I tried the same, but it doesnt work.
My Regional setting for number as follows 123,456,789
My code as follows
xamDataGrid.Language = XmlLanguage.GetLanguage(System.Threading.Thread.CurrentThread.CurrentCulture.Name);
field.Settings.EditorType =
typeof(XamNumericEditor);
By
Ramesh.P
Hello,
This is controlled by the ValueType property of the XamNumericEditor. Try setting it to int. The culture can be set through the Language property of the FrameworkElement.
In code behind, you can use something like this so that the culture is the same as the one in the regional settings of your computer.
XamNumericEditor xamNumericEditor = new XamNumericEditor();
xamDataGrid1.Language = XmlLanguage.GetLanguage(Thread.CurrentThread.CurrentCulture.Name);