The Load event for the "WPF" UserControl

Source: Internet
Author: User

After reviewing MSDN, summarize the following UserControl's Load event:

When did the Q1:load event occur?

Occurs before the control becomes visible the first time.

The Load event occurs when a UserControl is created, so in some cases the Load event is called multiple times, such as when the UserControl is loaded, or when the operation is rebuilt (in the case of a call to the Recreatehandle method to re-create a handle to the control).

Q2: What do I need to pay attention to using the Load event?

  1. If UserControl is part of an MDI child form, the load event is triggered each time the subform is displayed.
  2. Because the load event may be called multiple times, the initialization code should be placed in the constructor instead of the Load event. You should also not apply the data Binding in the event handler for load.

Q3: What should I do in the Load event?

You can allocate the resources used by UserControl in the event handler for the load.

The Load event for the "WPF" UserControl

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.