Hi
I have a grid and a button outside of the grid. My grid has 3 columns - id, name, and comment - and it is bound to an ObservableCollection and the RaisePropertyChanged event updates the cells properly with the exception of the last cell. For instance, I have 3 records and if I enter the comment on all 3 records and I click the button, only the first 2 commentswere saved. But if I click on another cell, after I entered the comment on 3 records, then I can see all of them. How can I fix this issue? Thanks!
Anyone????
Hi,
Could you provide some sample code that you are using?
Also, what is the purpose of the button, what does it do?
Thanks,
So your Data object never actually raises the property changed event.
You would need to do something like
public partial class Data : EntityBase {
private string _productName;
public string ProductName {get
{ return this._propertySTring; }
set{
if(value!=this._propertyString){
this._propertyString = value;
this.PropertyChangedHandler("PropertyString");
}
} }
Thanks for the reply. Here is my code:
public string productName {get; set;} public string Comment{get; set;} }
public abstract class EntityBase : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; protected void PropertyChangedHandler( string propertyName) { if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } }
//button click event below
ObservableCollection<Data> selectData = new ObservableCollection<Data>();
var qry = from rec in selectData select rec;
foreach (var item in qry) {
MessageBox.Show(item.Comment); }