1

I am new to wpf c# and MVVM approach. I have a working program that demonstrate the MVVM approach in wpf c# (by copying some code from the internet and applying it to may program). I have used ObservableCollection in my viewmodel and add my own object here. As I have said, it is working fin but the problem is I only have a single object. The question is how can I use RaisePropertyChanged to my object without using ObservableCollection? Is there a class that can trigger the change property of a single object or the only way is using ObservableCollection and add may only object to it? Please help me, all the examples I have seen in the internet is using ObservableCollection.

1 Answer 1

4

In general, your view model should be implementing INotifyPropertyChanged. It should then fire the PropertyChanged event whenever a property that the view is listening changes, and this will be picked up by the WPF framework. As you suspect, ObservableCollection is only for when you have a collection of things you want to monitor.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.