Hello,
when pressing the spin button in the NumericField, the underlying DataTable doesn't get updated. Only when I leave the cell. OnCellValueChanges is used.
<igDP:FieldSettings DataItemUpdateTrigger="OnCellValueChange"/>
<igDP:XamDataGrid x:Name="grdInfeed" GroupByAreaLocation="None" DataSource="{Binding InfeedTableView}" IsEnabled="{Binding IsEditable}"> <igDP:XamDataGrid.FieldLayoutSettings> <igDP:FieldLayoutSettings AutoGenerateFields="False" SelectionTypeCell="None"/> </igDP:XamDataGrid.FieldLayoutSettings> <igDP:XamDataGrid.FieldSettings> <igDP:FieldSettings DataItemUpdateTrigger="OnCellValueChange"/> </igDP:XamDataGrid.FieldSettings> <igDP:XamDataGrid.FieldLayouts> <igDP:FieldLayout> <igDP:TextField Name="COL_SortingProgramName" Label="{x:Static l:lang.MachineControl_Infeed_TableColumn_SortingProgram}" AllowEdit="False" Width="300"/> <igDP:NumericField Name="Speed" Label="{x:Static l:lang.MachineControl_Infeed_TableColumn_Speed}" Mask="{}{number:0-100}" SpinButtonDisplayMode="Always" > <igDP:NumericField.PromptChar> <sys:Char></sys:Char> </igDP:NumericField.PromptChar> </igDP:NumericField> <igDP:TextField Name="IsCurrent" Visibility="Collapsed"/> </igDP:FieldLayout> </igDP:XamDataGrid.FieldLayouts> </igDP:XamDataGrid>
Hello Bin,
Thank you for posting. I am not able to reproduce the behavior your described.
I used your code and bind with my own local data source and when I am pressing the spin button I noticed that underline dataitem did change without loosing the focus or leave the cell.
Here I attached my test sample build against V20.2.
Please test this project on your PC; whether or not it works correctly may help indicate the nature of this problem.
If this sample project is not an accurate demonstration of what you're trying to do, please feel free to modify it and send it back, or send a small sample project of your own if you have one.
Please let me know if I can provide any further assistance.
Regards,
8030.Sample.zip
Thank for your Sample. It is working when using a List and Objects. But when using a DataTable this it is not working.
I modified your sample with using a DataTable. Usage: When the data has changed the apply button should be enabled. In this scenario, only when I leave the row, the changes are transfered into the underling datatable.
1222.Sample.zip
Thank you for sharing the sample.
In the sample i noticed that your button is enabled based on HasDataChanged method , although in the HasDataChanged you are checking DataRowState unchanged , which I am not sure if the correct way to check the row state.
In the same method if you check the DataRowVersion Proposed value and Original value ,you will see those value changed.
public bool HasDataChanged() { bool hasChanges = false; foreach (DataRow row in _dataTable.Rows) { var vP = row[1,DataRowVersion.Proposed]; var vO = row[1, DataRowVersion.Original]; if (!object.Equals (vP,vO)) { hasChanges = true; }
So the incremented value is the proposed value, i.e. it has been changed.
When you enter edit mode on a datarow (or anything that implements ieditableobject)
We call beginedit, may be datatble dont change the RowState that why that is unchanged, but we don’t have control over.
May be check the Microsoft docs on the datarow/datatable and see what they might need to check or rely upon, may be HasVersion.