开发者

EF object property changing - MVVM

I have a viewmodel that has an EF object as one of its properties. The view has several text boxes wired up to that property via Text="{Binding Path=MyEFTable.Column1}". I'm using the MVVM Light toolkit so my viewmodels inherit ViewModelBase and subsequently each property calls RaisePropertyChanged() when changed.

I have noticed, however that changing MyEFTable.Column1 does not set off any cha开发者_开发百科nges in the viewmodel. I thought that EF objects tracked any changes, so I assumed that changing a column value in an EF object would cause the EF object itself to be changed. Is it no longer tracking changes since I am essentially copying the query result into a new MyEFTable object?


Does your bindable objects implement INotifyPropertyChanged or it's container, like ObservableCollection? Are you rising the event?

Using a view model is only the start. First thing you should check is to see if the Column1 Property is being updated after the editing occurs. If a TextBox, the UpdateSourceTrigger default value is LostFocus. Maybe you can try change it to PropertyChanged. If the value is updated in your MyEFTable.Column1 you're done. If not, again, something is using the INotifyPropertyChange.

Add more info and maybe the issue will be clearer.

HTH

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜