c# - ObservableCollection binded to DataGrid cell updated event -
code (related problem)
<datagrid grid.row="1" itemssource="{binding watchlist}" /> public static watchlistdata<quote> watchlist; watchlist=new watchlistdata <quote>(); public watchlistdata <quote> watchlist { { return watchlist; } set { watchlist = value; } } public class watchlistdata<quote> : observablecollection<quote> { protected override void oncollectionchanged(system.collections.specialized.notifycollectionchangedeventargs e) { base.oncollectionchanged(e); messagebox.show(e.action.tostring()); } } public class quote : inotifypropertychanged { private string _symbol; private double _last; public string symbol { { return _symbol; } set { _symbol = value; notifypropertychanged("symbol"); } } public double last { { return _last; } set { _last = value; notifypropertychanged("last"); } } public event propertychangedeventhandler propertychanged; private void notifypropertychanged(string propertyname) { if (propertychanged != null) { propertychanged(this, new propertychangedeventargs(propertyname)); } } } problem have wpf datagrid binded observablecollection. when user clicks datagrid, type text , press enter or click other row or window adds new line , need line , execute code. need event when user changes value in cell. i'm trying use override void oncollectionchanged fires when user start type in new cell (right after press first key, not when finished) , not firing when user changes text in existing cell. "add" action fires early, no "replace" action fires @ all. solutions possible?
Comments
Post a Comment