WPF-Application with delays after Update to Windows7

Sep 5, 2013 at 8:45 AM
Hello,
we've create a WPF-Application with Visual Studio 2010. It works fine since February 2012. After Updating the computer of the users from Windows XP to Windows7 the users have sometime to wait about 10 to 20 seconds while loading new data. We have logged each operation with a timestamp. So we can see, which operations cause the waiting. One of it is a own method name RaiseAllProperties, which call about 50 times the MVVM-Light-Function RaisePropertyChanged for the most properties of the ViewModel. To exclude MVVM-Light as cause of the delay, we want to install a newer version of MVVM-Light. We use the version 3.0.0 with the GalaSoft.MvvmLight.WPF4.dll with the assembly-version 3.0.0.30125.
I download the file GalaSoft.MvvmLight.V3.0.3.19.msi from http://www.galasoft.ch/mvvm/installing/. There is included the assembly GalaSoft.MvvmLight.WPF4.dll with the assembly-version 3.0.0.19994, which is lower then 3.0.0.30125. Is this right? What is the recommended version for production of MVVM-Light?
Visual Studio and a part of our users still use Windows XP.

The main delay occurs when clear a Observable Collection of a complex ViewModel. Have anybody an idea about the cause?
Thanks
Sep 6, 2013 at 12:26 PM
I've found know a non-Beta version 4.1.26, which I have installed with Nuget. The delay-problem doesn't disappear. I try to change the call of 50 RaisePropertyChanged to one call of RaisePropertyChanged(""). This works (Thank You!) but the delay is still the same. So I think it is not a problem of MVVM-Light.
Nevertheless, I would be glad, if anybody can help me with an idea about this issue.
Sep 9, 2013 at 2:30 PM
Not sure how anyone would be able to help you out - why don't you give more information like what exactly are the types of data you are binding to (like observable collections, strings, etc?), what type of UpdateMode you have set, are you using DispatcherHelper to sync back to UI thread..etc. etc.
Sep 10, 2013 at 7:16 AM
Edited Sep 10, 2013 at 9:30 AM
OK, I try to explain some more details. We use a WPF-Window with a ViewModel as DataContext. The ViewModel implements the browsing from one record to another. In the Window there is a control which contains a ListView of ListViews. These control has as DataContext an other ViewModel, which include a Observable Collection of a third ViewModel, which include a Observable Collection of one more ViewModel. The Properties of this ViewModels are Strings, Integers, Dates and Decimals. The ListViews are bound to these ViewModels. The ListViews show detail-data of the current record.
When changing to the next record, the ViewModel get new data from the database. When Clearing the outer Observable Collection the main delay appears.
I have now deleted the DataContext of the control, which include the Observable Collection. The result is, that we can't see data in the control, but in the ViewModel all things happens as before (clearing the Collections, reading data from the database, filling the collection new). Now the main delay disappears. This show, that not the clearing of the Observable Collection itself cause the delay but the Update of the UI.
The UpdateMode of the binding of the Observable Collection is not explicitly set, but works in the TwoWay-Mode:
        <ListView  ItemContainerStyle="{StaticResource MyListViewItemStyle}"     
            ItemsSource="{Binding Rechnungen}"
            SelectedItem="{Binding SelectedRechnung}" IsTabStop="False">
Wen don't use a DispatcherHelper or background thread or things like this.
When updating data, that are not part of an Observable Collection, RaisePropertyChanged is used to update the UI.
Sep 10, 2013 at 2:11 PM
Do you break the bindings first by setting your ObservableCollections to null before you re-populate them?
Sep 10, 2013 at 3:49 PM
No, we do this:
m_detailArt4ViewModel.Rechnungen.Clear()
There is a property with the last Rechnung, which was read from the database. For this we do this:
m_AktuelleRechnung.Dispose()
m_AktuelleRechnung = Nothing
Sep 10, 2013 at 4:16 PM
Edited Sep 10, 2013 at 4:17 PM
Have a look at this site about optimizing wpf performance, especially this section on collections
Sep 13, 2013 at 6:21 AM
Thank you for the link. I've try out Fix 1 of the section on collections, but it doesn't help. Fix 2 or 3 I will try later. First I will try now to isolate the problem by reducing the application.
Sep 30, 2013 at 6:39 AM
A short intermediate state of the issue: I've removed MVVM-Light from the project. The problem still appears, so we now can exclude MVVM-Light as cause of the delay.
Sep 30, 2013 at 2:38 PM
then now try this:

WPF Performance Suite