I have the following in xamDataGrid resources:
<Style x:Key="NumberStyle" TargetType="{x:Type igEditors:XamTextEditor}"> <Style.Setters> <Setter Property="Format" Value="#,##0.00"/> <Setter Property="InvalidValueBehavior" Value="RetainValue" /> <Setter Property="HorizontalContentAlignment" Value="Right"/> </Style.Setters> </Style>
And following field:
<igDP:UnboundField Name="PriceLocal" Width="70" Label="Price" Column="5" > <igDP:UnboundField.Settings> <igDP:FieldSettings EditorType="{x:Type igEditors:XamTextEditor}" EditorStyle="{StaticResource NumberStyle}" ></igDP:FieldSettings> </igDP:UnboundField.Settings> </igDP:UnboundField>
The above works for bound field but not for unbound field - please help!
Thanks.
Hello Jay6447,
I have been further researching this issue for you. What I can suggest is setting the EditAsType property for the UnboundField to be Decimal. Also I can suggest setting the EditorType for the UnboundField to be XamNumericEditor.
This way the formatting would apply.
Here is an example of the code, that you can use:
<igDP:UnboundField Name="Age" >
<igDP:UnboundField.Settings>
<igDP:FieldSettings EditorType="{x:Type igEditors:XamNumericEditor}"
EditAsType="{x:Type sys:Decimal}"
EditorStyle="{StaticResource NumberStyle}" >
</igDP:FieldSettings>
</igDP:UnboundField.Settings>
</igDP:UnboundField>
Please do not hesitate to let me know if you have any further questions on this matter.
I checked your video - there is a problem. The formatting of the Age field should be "#,##0.00" but it is showing as just 1000 (without comma and 2 decimal places).
Salary field is formatted correctly but not the Age field.
You can change the values of both salary and age fields to large decimal nos like 12123232.2222 and try it.
Thank you for the provided code snippets.
I have used them to create a sample application. In the sample application, when I click on the "Click Me" button the data for the 'Age' field is added and the style is applied.
I have created a video for you to see this behavior on my side. Would you please provide me with more detailed information regarding the environment in which you are developing your application (Operating system, Service Release, Integrated development environment and the specific version of our product that you are using and any other information that might help reproducing your issue), in order to be able to identify what might be causing this behavior?
Looking forward to hearing from you.
Try this - I have only attached the mainwindow.xaml and code behind files. You can probably just select-all and copy-paste the contents of both these files to your sample app. I have replaced the VM with a DataTable. The "Click Me" button will show the problem.
I have been looking into your posts. I have downloaded the sample application you were referring to in your latest post. When I open it, there is no code, just an empty project.
Would you please let me know if I am missing something?