Hello,
Is there any way to keep a double data type cell empty when there is no available data without threwing any exception?
Thanks.
I have defined a Converter and have the code like below, but it's not working:
<igDP:Field Name="Pension" Label="PENSION" Converter="converter"> <igDP:Field.Settings> <igDP:FieldSettings EditorType="{x:Type igEditors:XamNumericEditor}" EditAsType="{x:Type sys:Double}" /> </igDP:Field.Settings> </igDP:Field>
<igEditors:XamNumericEditor ValueType="{x:Type sys:Double}" Height="30" VerticalAlignment="Bottom" Value="{Binding Path=DataItem.Pension, ElementName=XamDataGrid1}"> <igEditors:XamNumericEditor.ValueConstraint> <igEditors:ValueConstraint Nullable="True" /> </igEditors:XamNumericEditor.ValueConstraint> </igEditors:XamNumericEditor>
There are two problems:
1. The igEditors:XamNumericEditor has no connection with the Pension fields
2. The Pension property doesn't like the converter.
Any idea how to fix?
Oh ok,
In this case, you have to set the EditAsType and/or EditorStyle properties of the Pension Field's Settings.
The EditorType should be XamNumericEditor and the EditAsType - Double. Then, you can create a class that inherits IValueConverter and apply that converter to the Converter property of the Field. The converter will take the string value of the pension and will return a double (converter) value to the Pension Field's cells.
Hi Alex,
What I want to do is to make the fields under the Pension label take empty (null) value when there are no double value available for that cell. I want to apply XamNumericEditor to all the fields under the pension label rather than an active record.
Below is another problem I have:
In my data source, the pension property is a string type, and it takes empty value. After I load the data source to the datagrid, I want to change the pension datatype to be double. I tried the below code, but is doesn't work:
this
.XamDataGrid1.FieldLayouts[0].Fields[6].DataType = Type.GetType("System.Double");
To what I see, you are trying to bind to a Pension property of the XamDataGrid, and it does not such.
I am assuming that you want to bind to the ActiveRecord of the XDG, in which case you should use:
Binding Path=ActiveRecord.DataItem.Pension, ElementName=XamDataGrid1. I was not able to understand you second question about the XamNumericEditor. Can you give us an example of what you are trying to achieve?
Thanks, Alex.
How could I apply the igEditors:XamNumericEditor to a datagrid or a column in the datagrid. I tried the following code, but it didn't work:
=XamDataGrid1}">
>
="300"/>
There is a property called Pension in my data source object.
Another question, the igEditors:XamNumericEditor appeared to be a seperate control on the user interface. Apart from setting the visibility to be false. Is there any way to add this kind of setting to the
<
igDP:Field.Settings> tag directly?