How can I edit the value of other cell on the fly based on change in one of the cells in xamgrid
Xamgrid has 2 columns with data from db
one column is editable
If i enter value in that editable column the value of other column should be calculated on fly
I am using IValueconverter but it isnt serving purpose
Hi,
I'm assuming you're using an UnboundColumn for the field you want to be updated?
If so, there is a Refresh method on a Cell, which you can call.
cell.Refresh();
However, there was a bug that caused this method not to work on UnboundCells, which will be coming out in the next SR, very soon.
-SteveZ
No not unbound column, both are from the database
What I did was created a new getter in the original object
In the CellExitedEditmode I am refreshing the datagrid
Do you think there would be any performance issues using either approach?
If your properties are generated, then that approach won't work.
You could just listen to the CellExitedEdit mode event then, and update the 2nd field your self via the Row data property off of the cell.
YourData data = e.Cell.Row.Data;
data.otherProperty = newCalculatedValue;
I created a partial class and am adding code with the same field name as gerenated by metadata.cs
public decimal Field1 { set { if (this._field1 != 0) { this._field1 = System.Convert.ToDouble(value);
this.OnPropertyChanged("Field1"); this.OnPropertyChanged("Field2"); } } }
But i get error that the 'xxx.web.classname' already contains definition for property Field1
Stephen
I am a newbie
Can you explain where will this code reside
Then you can simply raise the PropertyChanged event for your other property.
For example:
Prop1 and Prop2.
When i change Prop1, i want Prop2 to be updated as well, so in the Setter of Prop1
public obj Prop1{ set { if(this._prop1 != value) {
this._prop1 = value; this.OnPropertyChanged("Prop1"); this.OnPropertyChanged("Prop2");
} }}