I created a simple application with wpf and noticed a strange behavior: The application has two buttons, with unrelated and very simple behavior. Whenever I launch it, the first click of any of the buttons takes two to three seconds. Only the first click is slow. Subsequent clicks are almost instantaneous, as expected for their simple behavior. I was looking for google and SO, but no one seems to have encountered the same problem.
Application Details:
NorthWind db on SQL Server 2008;
Linq to SQL auto-generated classes;
Customers Table as DataGrid;
Button 1 OnClick Event: Context.SubmitChanges() ;
Button 2 OnClick The event alternates the logical DependencyProperty in the MainWindow class.
As you can see, the setup is very simple. If every button click was slow, I would attribute them to WPF performance issues. It is strange that whenever I launch it, only the first click responds slowly, and the others are normal.
jose
source share