PRISM RaisePropertyChanged

Hi
I'm using prism and MVVM architecture for my WPF application and I have a problem with RaisePropertyChanged,I have a gridview in my view that its itemsource is binded to an ObservableCollection named AllOrderProducts in my viewmodel,the problem is that when
I change AllOrderProducts and i use this.RaisePropertyChanged(() => this.AllOrderProducts);
in doesn't refresh the gridview in my view, and I have this problem with other fields or properties in my viewmodel when I use RaisePropertyChanged

In my opinion, the problem you are experiencing might be related to the following line of the code snippets you posted:

// In the GetAllOrderProducts methodthis.AllOrderProducts = new ObservableCollection<ROrderProducts>(tmp.ToList());

According to the description of the
ObservableCollection class, the collection notifies a change when an item is
added, removed or when the collection is refreshed. However, in the aforementioned line of code, none of these operations is performed; instead, the whole collection is replaced with a new one. This mean that the collection
is not being modified; the one modified is the property that references the collection.

Based on my understanding, a possible approach could be to invoke the
RaisePropertyChanged method right after the aforementioned line.

If this is not the case, it would be helpful if you could provide us with a repro sample application portraying this problem so that we can help you further with this.

After we could mock the database and make the sample to run correctly, we found that the error you are experiencing is being caused by the fact that your
OrderView and OrderDetailView (the one that host the
RadDataGrid) are using two different instances of the same view model.

The reason behind this is that the OrderViewModel is being exported with the attribute
[PartCreationPolicy(CreationPolicy.NonShared)]. This means that each time this type is
imported a different instance of the view model will be created. As both the
OrderView and the OrderDetailView declare an import of type
OrderViewModel in their code behind, each of the views will obtain a different instance of the view model.

When you invoked the RaisePropertyChange method in the view model of the
OrderView, the view was notified of the changes correctly. But as the
OrderDetailView had a different view model, no changes in the data were performed and no notifications were raised to this view.

If you wish to share the same view model between the two views, a possible approach could be to define the
OrderViewModel as a singleton by changing the aforementioned attribute for this one:
[PartCreationPolicy(CreationPolicy.Shared)]. Another possible approach is to eliminate the
ViewModel property and its Import attribute from the
OrderDetailView's code behind. The view then will inherit the view model of the
OrderView. As a side note we have checked that both approaches seem to work correctly.