Where did the Loading Event go?

In earlier Versions of WPF Pages and Windows provided a Loading Event.
I used to placed all my data initialization code that affects databinding here.
Since this event is gone I placed the code into the Loaded Event.
This is very uncompfortable because the page is displayed before this code is executed.
I also tried to put some code into the constructor but this wasn't a good idea because it is not guaranteed that all controls are initilized at that moment.

So I searched the MSDN for that issue and found the Initialized Event as a solution.
When this event is fired all controls are initialized but the page is not yet displayed!
You can perform any databining related actions there and the user will only see the result.
Besides this is more performant than putting the code into the Loaded event because WPF doesn't need to set and render all databinding fields twice!

Comments

Popular posts from this blog

Custom Chrome in WPF

Capture WebCam with WinForms2

WPF: Binding updates